Techniques for decoding or coding images based on multiple intra-prediction modes

ABSTRACT

Aspects of the present disclosure provide techniques for derive one or more intra prediction modes (IPMs) from a subset of IPM candidates in order to determine a predictor to use for decoding a block of an image. In some aspects, the subset of IPM candidates may include IPMs that are less than the number of IPMs in a full set of all available IPM candidates (e.g., 67 IPMs in VVC or 35 in HEVC). In some aspects, the subset of IPM candidates may be based on a most probable mode (MPM) list that can be used to determine or signal an IPM based on IPMs previously used in decoding other blocks.

BACKGROUND

The present disclosure relates generally to video coding, and more particularly, to video encoding and decoding based on an intra-prediction mode (IPM) that is selected from a subset of IPM candidates.

SUMMARY

The following presents a simplified summary of one or more aspects in order to provide a basic understanding of such aspects. This summary is not an extensive overview of all contemplated aspects, and is intended to neither identify key or critical elements of all aspects nor delineate the scope of any or all aspects. Its sole purpose is to present some concepts of one or more aspects in a simplified form as a prelude to the more detailed description that is presented later.

In one aspect, a method for coding video data. The method may further include constructing, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates. The method may further include deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks. The method may also include performing the conversion based on the final predictor.

In another aspect, an apparatus for coding video data that includes a memory, and one or more processors coupled to the memory. The one or more processors are configured to construct, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates. The one or more processors are further configured to derive, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks. The one or more processors are configured to determine, based on the at least one IPM, a final predictor of the current video block. The one or more processors are further configured to perform the conversion based on the final predictor.

In another aspect, a non-transitory computer-readable medium including code executable by one or more processors for coding video data is provided. The code includes code for constructing, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates. The code further includes code for deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks. The code further includes code for determining, based on the at least one IPM, a final predictor of the current video block. The one or more processors are further configured to perform the conversion based on the final predictor.

To the accomplishment of the foregoing and related ends, the one or more aspects include the features hereinafter fully described and particularly pointed out in the claims. The following description and the annexed drawings set forth in detail some illustrative features of the one or more aspects. These features are indicative, however, of but a few of the various ways in which the principles of various aspects may be employed, and this description is intended to include all such aspects and their equivalents.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram that illustrates an example of a video coding system, in accordance with some aspects of the present disclosure.

FIG. 2 is a block diagram that illustrates a first example of a video encoder, in accordance with some aspects of the present disclosure.

FIG. 3 is a block diagram that illustrates an example of a video decoder, in accordance with some aspects of the present disclosure.

FIG. 4 is a block diagram that illustrates a second example of a video encoder, in accordance with some aspects of the present disclosure.

FIG. 5 is an example of an encoder block diagram of versatile video coding (VVC) in accordance with some aspects of the present disclosure.

FIG. 6 is a schematic diagram of intra mode coding with 67 intra-prediction modes to capture the arbitrary edge directions presented in natural video in accordance with some aspects of the present disclosure.

FIGS. 7 and 8 are reference example diagrams of wide-angular intra-prediction in accordance with some aspects of the present disclosure.

FIG. 9 is a diagram of discontinuity in case of directions that exceed 45° angle in accordance with some aspects of the present disclosure.

FIG. 10 is a schematic diagram of location of the samples used for the derivation of α and β for the chroma in accordance with some aspects of the present disclosure.

FIG. 11 is a schematic diagram of location of the samples used for the derivation of α and β for the luma in accordance with some aspects of the present disclosure.

FIGS. 12-15 illustrate examples of reference samples (Rx,−1 and R−1,y) for PDPC applied over various prediction modes in accordance with some aspects of the present disclosure.

FIG. 16 is a diagram of multiple reference line (MRL) intra-prediction used in accordance with aspects of the present disclosure.

FIGS. 17 and 18 are example diagrams and of an intra sub-partitions (ISP) that divides luma intra-predicted blocks vertically or horizontally into sub-partitions depending on the block size in accordance with some aspects of the present disclosure.

FIG. 19 is a diagram of a matrix weighted intra-prediction process (MIP) method for VVC in accordance with some aspects of the present disclosure.

FIG. 20 is a diagram of a template based intra mode derivation where the target denotes the current block (of block size N) for which intra-prediction mode is to be estimated in accordance with some aspects of the present disclosure.

FIG. 21 is a diagram of a template of a set of chosen pixels on which a gradient analysis may be performed based on intra-prediction mode derivation in accordance with some aspects of the present disclosure.

FIG. 22 is a diagram of a convolution of a 3×3 sobel gradient filter with the template in accordance with aspects of the present disclosure.

FIG. 23 is a schematic diagram of intra mode coding with greater than 67 intra-prediction modes to capture the arbitrary edge directions presented in natural video in accordance with some aspects of the present disclosure.

FIG. 24 is a diagram of an example template including a left-above sub-template in accordance with some aspects of the present disclosure.

FIG. 25 is a diagram of an example template including a left sub-template and an above sub-template in accordance with some aspects of the present disclosure.

FIG. 26 is a diagram of an example template including an above sub-template in accordance with some aspects of the present disclosure.

FIG. 27 is a diagram of an example template including a left sub-template in accordance with some aspects of the present disclosure.

FIG. 28 is a diagram of an example template including a left sub-template and a left-below sub-template in accordance with some aspects of the present disclosure.

FIG. 29 is a diagram of an example template including an above sub-template and a right-above sub-template in accordance with some aspects of the present disclosure.

FIG. 30 is a diagram of an example template including a left sub-template, a left-below sub-template, an above sub-template, and a right-above sub-template in accordance with some aspects of the present disclosure.

FIG. 31 is a diagram of an example template including a left-above sub-template, a left sub-template, a left-below sub-template, an above sub-template, and a right-above sub-template in accordance with some aspects of the present disclosure.

FIG. 32 is a diagram of an example template including sub-templates that are spaced apart from a target block in accordance with some aspects of the present disclosure.

FIG. 33 is a diagram of example template-reference samples for a template including a left-above sub-template, a left sub-template, and an above sub-template in accordance with some aspects of the present disclosure.

FIG. 34 is a diagram of example template-reference samples for a template including a left sub-template and an above sub-template in accordance with some aspects of the present disclosure.

FIG. 35 is a diagram of example template-reference samples for a template including an above sub-template in accordance with some aspects of the present disclosure.

FIG. 36 is a diagram of example template-reference samples for a template including a left sub-template in accordance with some aspects of the present disclosure.

FIG. 37 is a diagram of example template-reference samples with a horizontal gap for a template including an above sub-template in accordance with some aspects of the present disclosure.

FIG. 38 is a diagram of example template-reference samples with a vertical gap for a template including an above sub-template in accordance with some aspects of the present disclosure.

FIG. 39 is a diagram of example template-reference samples with a vertically shifted portion for a template in accordance with some aspects of the present disclosure.

FIG. 40 is a diagram of example template-reference samples with a horizontally shifted portion for a template in accordance with some aspects of the present disclosure.

FIG. 41 is a diagram of an example video decoder in accordance with some aspects of the present disclosure.

FIG. 42 is a flowchart of an example method of decoding a bitstream in accordance with some aspects of the present disclosure.

DETAILED DESCRIPTION

The detailed description set forth below in connection with the appended drawings is intended as a description of various configurations and is not intended to represent the only configurations in which the concepts described herein may be practiced. The detailed description includes specific details for the purpose of providing a thorough understanding of various concepts. However, it will be apparent to a person having ordinary skill in the art that these concepts may be practiced without these specific details. In some instances, structures and components are shown in block diagram form in order to avoid obscuring such concepts.

Several aspects of video coding and decoding will now be presented with reference to various apparatus and methods. These apparatus and methods will be described in the following detailed description and illustrated in the accompanying drawings by various blocks, components, circuits, processes, algorithms, among other examples (collectively referred to as “elements”). These elements may be implemented using electronic hardware, computer software, or any combination thereof. Whether such elements are implemented as hardware or software depends upon the particular application and design constraints imposed on the overall system.

By way of example, an element, or any portion of an element, or any combination of elements may be implemented as a “processing system” that includes one or more processors. Examples of processors include microprocessors, microcontrollers, graphics processing units (GPUs), central processing units (CPUs), application processors, digital signal processors (DSPs), reduced instruction set computing (RISC) processors, systems on a chip (SoC), baseband processors, field programmable gate arrays (FPGAs), programmable logic devices (PLDs), state machines, gated logic, discrete hardware circuits, and other suitable hardware configured to perform the various functionality described throughout this disclosure. One or more processors in the processing system may execute software. Software shall be construed broadly to mean instructions, instruction sets, code, code segments, program code, programs, subprograms, software components, applications, software applications, software packages, routines, subroutines, objects, executables, threads of execution, procedures, functions, among other examples, whether referred to as software, firmware, middleware, microcode, hardware description language, or otherwise.

Accordingly, in one or more examples, the functions described may be implemented in hardware, software, or any combination thereof. If implemented in software, the functions may be stored on or encoded as one or more instructions or code on a computer-readable medium. Computer-readable media includes computer storage media. Storage media may be any available media that can be accessed by a computer. By way of example, and not limitation, such computer-readable media can include a random-access memory (RAM), a read-only memory (ROM), an electrically erasable programmable ROM (EEPROM), optical disk storage, magnetic disk storage, other magnetic storage devices, combinations of the aforementioned types of computer-readable media, or any other medium that can be used to store computer executable code in the form of instructions or data structures that can be accessed by a computer.

Aspects described herein generally relate to using multiple intra-prediction modes (IPMs) in decoding (or encoding) images. For example, video coding technologies, such as high efficiency video coding (HEVC), versatile video coding (VVC), etc., can use IPMs at the encoding side and decoding side to encode/decode each image or frame of a video, such to compress the number of bits in the bitstream, which can provide for efficient storage or transmission of the image or frame, and thus the video. As described in further detail herein, the IPMs are determined or specified per block of an image, where a block can include a portion of the image defined by a subset of coding units CUs or prediction units (PUs) (e.g., N×N CUs or PUs), where each CU or PU can be a pixel, a chroma, a luma, a collection of such, etc. The IPM is then used to predict a given block based on reference pixels, chromas, lumas, etc. of a previously decoded block. This can save from storing or communicating values for each pixel, chroma, or luma, etc. In current video coding technologies, there are a number of conventional IPMs (e.g., 67 IPMs in VVC or 35 in HEVC).

In accordance with aspects described herein, given a bitstream that represents an image to be displayed, a block of the image can be derived based on multiple IPMs to use in decoding the block. Based on the multiple conventional IPMs, a final predictor can be determined for predicting a current block to be decoded. However, in conventional systems, the decoder may need to test or consider all possible IPMs (e.g., 67 IPMs in VVC or 35 in HEVC) that can be signalled from the encoder for each block of image. Multiplying such efforts for each block and each frame of a video, however, may expend valuable computational resources of the computing device associated with the decoder and add unnecessary latency in produced the regenerated image.

Thus, as opposed to explicitly signalling IPM of a block to the decoder, aspects of the present disclosure derive one or more intra prediction modes (IPMs) which are from a subset of IPM candidates in the decoder implicitly wherein the subset of IPM candidates contains a smaller number of IPMs than the full set of all available IPM candidates (e.g., 67 IPMs in VVC or 35 in HEVC). In some aspects, the subset of IPM candidates may be based on a most probable mode (MPM) list that can be used to determine or signal an IPM based on IPMs previously used in decoding other blocks. For example, in decoding the block, an IPM can be determined based on the final predictor and based on the MPM list, which can include determining the IPM from the list as the final predictor, or as a conventional IPM (e.g., where the final predictor is not a conventional IPM) based on the MPM list and the final predictor.

The detailed inventions below should be considered as examples to explain general concepts. These inventions should not be interpreted in a narrow way. Furthermore, these inventions can be combined in any manner.

In this disclosure, the term DIMD represents a coding tool that derives intra prediction mode using previously decoded blocks. In the disclosure, the “conventional intra prediction mode (IPM) candidate set” may be used to indicate the allowed IPMs for intra-coded blocks (e.g., the 35 modes in HEVC, the 67 modes in VVC), and a “conventional intra prediction mode” may refer to an IPM in the conventional IPM candidate set.

In this disclosure, the “horizontal mode” may refer to the intra prediction mode with mode number being equal to 18 in FIG. 6. The “vertical mode” refers to the intra prediction mode with mode number being equal to 50 in FIG. 6. The “diagonal top-right mode” refers to the intra prediction mode with mode number being equal to 65 in FIG. 6. The “diagonal bottom-left mode” refers to the intra prediction mode with mode number being equal to 2 in FIG. 6. The “diagonal top-left mode” refers to the intra prediction mode with mode number being equal to 34 in FIG. 6. These intra prediction modes may also refer to the intra prediction modes having the same direction in HEVC.

In this disclosure, the “template-reference samples” refers to the reconstructed samples used as the reference to derive the predicted samples of a template.

In this disclosure, the “the (derived) IPM is applied/used/enabled to a block” refers to the predictor of the block is generated using the (derived) IPM.

FIG. 1 is a block diagram that illustrates an example of a video coding system 100 that may utilize the techniques of this disclosure. As shown in FIG. 1, video coding system 100 may include a source device 110 and a destination device 120. The source device 110, which may be referred to as a video encoding device, may generate encoded video data. The destination device 120, which may be referred to as a video decoding device, may decode the encoded video data generated by the source device 110. The source device 110 may include a video source 112, a video encoder 114, and an input/output (I/O) interface 116.

The video source 112 may include a source such as a video capture device, an interface to receive video data from a video content provider, and/or a computer graphics system for generating video data, or a combination of such sources. The video data may comprise one or more pictures or images. The terms “picture,” “image,” or “frame” can be used interchangeably throughout to refer to a single image in a stream of images that produce a video. The video encoder 114 encodes the video data from the video source 112 to generate a bitstream. The bitstream may include a sequence of bits that form a coded representation of the video data. The bitstream may include coded pictures and associated data. The coded picture is a coded representation of a picture. The associated data may include sequence parameter sets, picture parameter sets, and other syntax structures. The I/O interface 116 may include a modulator/demodulator (modem) and/or a transmitter, a bus, or substantially any mechanism that facilitates transfer of data between devices or within a computing device that may include both the source device 110 and destination device 120 (e.g., where the computing device stores the encoded video generated using functions of the source device 110 for display using functions of the destination device 120). In one example, the encoded video data may be transmitted directly to destination device 120 via the I/O interface 116 through the network 130 a. The encoded video data may also be stored onto a storage medium/server 130 b for access by destination device 120.

The destination device 120 may include an I/O interface 126, a video decoder 124, and a display device 122. The I/O interface 126 may include a receiver and/or a modem, a bus, or substantially any mechanism that facilitates transfer of data between devices or within a computing device. The I/O interface 126 may acquire encoded video data from the source device 110 or the storage medium/server 130 b. The video decoder 124 may decode the encoded video data. The display device 122 may display the decoded video data to a user. The display device 122 may be integrated with the destination device 120, or may be external to the destination device 120 which be configured to interface with an external display device.

The video encoder 114 and the video decoder 124 may operate according to a video compression standard, such as the HEVC standard, VVC standard and other current and/or further standards.

FIG. 2 is a block diagram illustrating an example of a video encoder 200, which may be an example of the video encoder 114 in the system 100 illustrated in FIG. 1, in accordance with some aspects of the present disclosure.

The video encoder 200 may be configured to perform any or all of the techniques of this disclosure. In the example of FIG. 2, the video encoder 200 includes a plurality of functional components. The techniques described in this disclosure may be shared among the various components of the video encoder 200. In some examples, a processor may be configured to perform any or all of the techniques described in this disclosure, including those of video encoder 200.

The functional components of video encoder 200 may include one or more of a partition unit 201, a prediction unit 202 which may include a mode select unit 203, a motion estimation unit 204, a motion compensation unit 205 and an intra-prediction unit 206, a residual generation unit 207, a transform unit 208, a quantization unit 209, an inverse quantization unit 210, an inverse transform unit 211, a reconstruction unit 212, a buffer 213, and an entropy encoding unit 214.

In other examples, the video encoder 200 may include more, fewer, or different functional components. In an example, the prediction unit 202 may include an intra block copy (IBC) unit. The IBC unit may perform prediction in an IBC mode in which at least one reference picture is a picture where the current video block is located.

Furthermore, some components, such as the motion estimation unit 204 and the motion compensation unit 205, may be highly integrated, but are separately represented in the example of FIG. 2 for purposes of explanation.

The partition unit 201 may partition a picture into one or more video blocks. The video encoder 200 and the video decoder 300 may support various video block sizes.

The mode select unit 203 may select one of the coding modes, intra or inter, e.g., based on error results, and provide the resulting intra- or inter-coded block to at least one of a residual generation unit 207 to generate residual block data and to a reconstruction unit 212 to reconstruct the encoded block for use as a reference picture. In some examples, the mode select unit 203 may select a combination of intra- and inter-prediction (CIIP) mode in which the prediction is based on an inter-prediction signal and an intra-prediction signal. The mode select unit 203 may also select a resolution for a motion vector (e.g., a sub-pixel or integer pixel precision) for the block in the case of inter-prediction.

To perform inter-prediction on a current video block, the motion estimation unit 204 may generate motion information for the current video block by comparing one or more reference frames from buffer 213 to the current video block. In an example, each reference frame can correspond to a picture of the video. The motion compensation unit 205 may determine a predicted video block for the current video block based on the motion information and decoded samples of pictures from the buffer 213 other than the picture associated with the current video block.

The motion estimation unit 204 and the motion compensation unit 205 may perform different operations for a current video block, for example, depending on whether the current video block is in an I-slice, a P-slice, or a B-slice. As used herein, in some aspects, an “I-slice” may refer to a portion of a picture composed of macroblocks, all of which are based upon macroblocks within the same picture. Further, as used herein, in some aspects, “P-slices” and “B-slices” may refer to portions of a picture composed of macroblocks that are not dependent on macroblocks in the same picture.

In some examples, the motion estimation unit 204 may perform uni-directional prediction for the current video block, and the motion estimation unit 204 may search reference pictures of list 0 or list 1 for a reference video block for the current video block. The motion estimation unit 204 may then generate a reference index that indicates the reference picture in list 0 or list 1 that contains the reference video block and a motion vector that indicates a spatial displacement between the current video block and the reference video block. The motion estimation unit 204 may output the reference index, a prediction direction indicator, and the motion vector as the motion information of the current video block. The motion compensation unit 205 may generate the predicted video block of the current block based on the reference video block indicated by the motion information of the current video block.

In other examples, the motion estimation unit 204 may perform bi-directional prediction for the current video block, where the motion estimation unit 204 may search the reference pictures in list 0 for a reference video block for the current video block and may also search the reference pictures in list 1 for another reference video block for the current video block. The motion estimation unit 204 may then generate reference indexes that indicate the reference pictures in list 0 and list 1 containing the reference video blocks and motion vectors that indicate spatial displacements between the reference video blocks and the current video block. The motion estimation unit 204 may output the reference indexes and the motion vectors of the current video block as the motion information of the current video block. The motion compensation unit 205 may generate the predicted video block of the current video block based on the reference video blocks indicated by the motion information of the current video block.

In some examples, the motion estimation unit 204 may output a full set of motion information for decoding processing of a decoder.

In some examples, the motion estimation unit 204 may not output a full set of motion information for the current video. Rather, the motion estimation unit 204 may signal the motion information of the current video block with reference to the motion information of another video block. For example, the motion estimation unit 204 may determine that the motion information of the current video block is sufficiently similar to the motion information of a neighboring video block.

In one example, the motion estimation unit 204 may indicate, in a syntax structure associated with the current video block, a value that indicates to the video decoder 300 that the current video block has the same motion information as the another video block.

In another example, the motion estimation unit 204 may identify, in a syntax structure associated with the current video block, another video block and a motion vector difference (MVD). The motion vector difference indicates a difference between the motion vector of the current video block and the motion vector of the indicated video block. The video decoder 300 may use the motion vector of the indicated video block and the motion vector difference to determine the motion vector of the current video block.

As discussed above, video encoder 200 may predictively signal the motion vector. Two examples of predictive signaling techniques that may be implemented by video encoder 200 include advanced motion vector prediction (AMVP) and merge mode signaling.

The intra-prediction unit 206 may perform intra-prediction on the current video block. When the intra-prediction unit 206 performs intra-prediction on the current video block, the intra-prediction unit 206 may generate prediction data for the current video block based on decoded samples of other video blocks in the same picture. The prediction data for the current video block may include at least one of a predicted video block or one or more syntax elements.

The residual generation unit 207 may generate residual data for the current video block by subtracting (e.g., indicated by the minus sign) the predicted video block(s) of the current video block from the current video block. The residual data of the current video block may include residual video blocks that correspond to different sample components of the samples in the current video block.

In other examples, there may be no residual data for the current video block for the current video block, for example in a skip mode, and the residual generation unit 207 may not perform the subtracting operation.

The transform processing unit 208 may generate one or more transform coefficient video blocks for the current video block by applying one or more transforms to a residual video block associated with the current video block.

After the transform processing unit 208 generates a transform coefficient video block associated with the current video block, the quantization unit 209 may quantize the transform coefficient video block associated with the current video block based on one or more quantization parameter (QP) values associated with the current video block.

The inverse quantization unit 210 and the inverse transform unit 211 may apply inverse quantization and inverse transforms to the transform coefficient video block, respectively, to reconstruct a residual video block from the transform coefficient video block. The reconstruction unit 212 may add the reconstructed residual video block to corresponding samples from one or more predicted video blocks generated by the prediction unit 202 to produce a reconstructed video block associated with the current block for storage in the buffer 213.

After the reconstruction unit 212 reconstructs the video block, loop filtering operation may be performed to reduce video blocking artifacts in the video block.

The entropy encoding unit 214 may receive data from other functional components of the video encoder 200. When entropy encoding unit 214 receives the data, entropy encoding unit 214 may perform one or more entropy encoding operations to generate entropy encoded data and output a bitstream that includes the entropy encoded data.

FIG. 3 is a block diagram illustrating an example of video decoder 300, which may be an example of the video decoder 124 in the system 100 illustrated in FIG. 1, in accordance with some aspects of the present disclosure.

The video decoder 300 may be configured to perform any or all of the techniques of this disclosure. In the example of FIG. 3, the video decoder 300 includes a plurality of functional components. The techniques described in this disclosure may be shared among the various components of the video decoder 300. In some examples, a processor may be configured to perform any or all of the techniques described in this disclosure, including those of video decoder 300.

In the example of FIG. 3, the video decoder 300 includes one or more of an entropy decoding unit 301, a motion compensation unit 302, an intra-prediction unit 303, an inverse quantization unit 304, an inverse transformation unit 305, a reconstruction unit 306, and a buffer 307. The video decoder 300 may, in some examples, perform a decoding pass generally reciprocal to the encoding pass described with respect to video encoder 200 (FIG. 2).

The video decoder 300 may receive, via the entropy decoding unit 301 or otherwise, an encoded bitstream. The encoded bitstream may include entropy coded video data (e.g., encoded blocks of video data). In this example, the entropy decoding unit 301 may decode the entropy coded video data. Based on the decoded video data, whether entropy decoded or otherwise, the motion compensation unit 302 may determine motion information including motion vectors, motion vector precision, reference picture list indexes, and other motion information. The motion compensation unit 302 may, for example, determine such information by performing the AMVP and merge mode. AMVP may be used, including derivation of several most probable candidates based on data from adjacent PBs and the reference picture. Motion information typically includes the horizontal and vertical motion vector displacement values, one or two reference picture indices, and, in the case of prediction regions in B slices, an identification of which reference picture list is associated with each index. As used herein, in some aspects, a “merge mode” may refer to deriving the motion information from spatially or temporally neighboring blocks.

The motion compensation unit 302 may produce motion compensated blocks, possibly performing interpolation based on interpolation filters. Identifiers for interpolation filters to be used with sub-pixel precision may be included in syntax elements received with the encoded bitstream or in separate assistance information, e.g., as specified by a video encoder when encoding the video.

The motion compensation unit 302 may use interpolation filters as used by video encoder 200 during encoding of the video block to calculate interpolated values for sub-integer pixels of a reference block. The motion compensation unit 302 may determine the interpolation filters used by video encoder 200 according to received syntax information and use the interpolation filters to produce predictive blocks.

The motion compensation unit 302 may use some of the syntax information to determine sizes of blocks used to encode frame(s) and/or slice(s) of the encoded video sequence, partition information that describes how each macroblock of a picture of the encoded video sequence is partitioned, modes indicating how each partition is encoded, one or more reference frames (and reference frame lists) for each inter-encoded block, and other information to decode the encoded video sequence. As used herein, in some aspects, a “slice” may refer to a data structure that can be decoded independently from other slices of the same picture, in terms of entropy coding, signal prediction, and residual signal reconstruction. A slice can either be an entire picture or a region of a picture.

The intra-prediction unit 303 may use intra-prediction modes for example received in the bitstream to form a prediction block from spatially adjacent blocks. Intra-prediction can be referred to herein as “intra,” and/or intra-prediction modes can be referred to herein as “intra modes” The inverse quantization unit 304 inverse quantizes, i.e., de-quantizes, the quantized video block coefficients provided in the bitstream and decoded by entropy decoding unit 301. Inverse transform unit 305 applies an inverse transform.

The reconstruction unit 306 may sum the residual blocks with the corresponding prediction blocks generated by motion compensation unit 202 or intra-prediction unit 303 to form decoded blocks. If desired, a deblocking filter may also be applied to filter the decoded blocks in order to remove blockiness artifacts. The decoded video blocks are then stored in buffer 307, which provides reference blocks for subsequent motion compensation/intra-prediction and also produces decoded video for presentation on a display device.

Although the following description may be focused on High Efficiency Video Coding (HEVC), and/or the standard Versatile Video Coding (VVC), the concepts described herein may be applicable to other coding standards or video codec.

FIG. 4 shows an example of a block diagram of a HEVC video encoder and decoder 400, which may be the video encoder 114 and video decoder 124 in the system 100 illustrated in FIG. 1, video encoder 200 in FIG. 2 and video decoder 300 in FIG. 3, etc., in accordance with some aspects of the present disclosure. The encoding algorithm for generating HEVC-compliant bitstreams may proceed as follows. Each picture can be divided into block regions (e.g., coding tree units (CTUs)), and the precise block division may be transmitted to the decoder. A CTU consists of a luma coding tree block (CTB) and the corresponding chroma CTBs and syntax elements. The size L×L of a luma CTB can be chosen as L=16, 32, or 64 samples, where the larger sizes can enable higher compression. HEVC then supports a partitioning of the CTBs into smaller blocks using a tree structure and quadtree-like signaling. The quadtree syntax of the CTU specifies the size and positions of its luma and chroma CBs. The root of the quadtree is associated with the CTU. Hence, the size of the luma CTB is the largest supported size for a luma CB. The splitting of a CTU into luma and chroma CBs may be jointly signaled. One luma CB and ordinarily two chroma CBs, together with associated syntax, form a coding unit (CU). A CTB may contain only one CU or may be split to form multiple CUs, and each CU has an associated partitioning into prediction units (PUs) and a tree of transform units (TUs).

The first picture of the video sequence (and/or the first picture at each clean random access point that enters the video sequence) can use only intra-picture prediction, which uses region-to-region spatial data prediction within the same picture, but does not rely on other pictures to encode the first picture. For the remaining pictures between sequential or random access points, the inter-picture temporal prediction coding mode may be used for most blocks. The encoding process for inter-picture prediction includes selecting motion data including a selected reference picture and a motion vector (MV) to be applied to predict samples of each block.

The decision whether to code a picture area using inter-picture or intra-picture prediction can be made at the CU level. A PU partitioning structure has its root at the CU level. Depending on the basic prediction-type decision, the luma and chroma CBs can then be further split in size and predicted from luma and chroma prediction blocks (PBs). HEVC supports variable PB sizes from 64×64 down to 4×4 samples. The prediction residual is coded using block transforms. A TU tree structure has its root at the CU level. The luma CB residual may be identical to the luma transform block (TB) or may be further split into smaller luma TBs. The same applies to the chroma TBs.

The encoder and decoder may apply motion compensation (MC) by using MV and mode decision data to generate the same inter-picture prediction signal, which is transmitted as auxiliary information. The residual signal of intra-picture or inter-picture prediction can be transformed by linear spatial transformation, which is the difference between the original block and its prediction. Then the transform coefficients can be scaled, quantized, entropy encoded, and transmitted together with the prediction information.

The encoder can duplicate the decoder processing loop so that both can generate the same prediction for subsequent data. Therefore, the quantized transform coefficients can be constructed by inverse scaling, and then can be inversely transformed to replicate the decoding approximation of the residual signal. The residual can then be added to the prediction, and the result of this addition can then be fed into one or two loop filters to smooth the artifacts caused by block-by-block processing and quantization. The final picture representation (i.e., the copy output by the decoder) can be stored in the decoded picture buffer for prediction of subsequent pictures. In general, the order of encoding or decoding processing of pictures may be different from the order in which they arrive from the source. As such, in some examples, it may be necessary to distinguish between the decoding order of the decoder (that is, the bit stream order) and the output order (that is, the display order).

Video material encoded by HEVC can be input as a progressive image (e.g., because the source video originates from this format or is generated by de-interlacing before encoding). There is no explicit coding feature in the HEVC design to support the use of interlaced scanning, because interlaced scanning is no longer used for displays and becomes very uncommon for distribution. However, metadata syntax has been provided in HEVC to allow the encoder to indicate that it has been sent by encoding each area of the interlaced video (i.e., even or odd lines of each video frame) into a separate picture interlaced video, or by encoding each interlaced frame as a HEVC encoded picture to indicate that it has been sent. This can provide an effective method for encoding interlaced video without the need to support special decoding processes for it.

FIG. 5 is an example of an encoder block diagram 500 of VVC, which can include multiple in-loop filtering blocks: e.g., deblocking filter (DF), sample adaptive offset (SAO) adaptive loop filter (ALF), etc. Unlike DF, which uses predefined filters, SAO and ALF may utilize the original samples of the current picture to reduce the mean square errors between the original samples and the reconstructed samples by adding an offset and by applying a finite impulse response (FIR) filter, respectively, with coded side information signaling the offsets and filter coefficients. ALF may be located at the last processing stage of each picture and can be regarded as a tool to catch and fix artifacts created by the previous stages.

FIG. 6 is a schematic diagram 600 of intra-prediction mode coding with 67 intra-prediction modes to capture the arbitrary edge directions presented in natural video. In some examples, the number of directional intra modes may be extended from 33, as used in HEVC, to 65 while the planar and the DC modes remain the same.

In some examples, the denser directional intra-prediction modes may apply for the block sizes and for both luma and chroma intra-predictions. In the HEVC, every intra-prediction mode coded block may include a square shape (e.g., a coded block of size N×N) and the length of each of its side may be a power of 2 (e.g., where N is a power of 2). Thus, no division operations are required to generate an intra-predictor using DC mode. In VVC, blocks can have a rectangular shape that may necessitate the use of a division operation per block in the general case. To avoid division operations for DC prediction, the longer side may be used to compute the average for non-square blocks.

Although 67 modes are defined in the VVC, the exact prediction direction for a given intra-prediction mode index may be further dependent on the block shape. Conventional angular intra-prediction directions are defined from 45 degrees to −135 degrees in clockwise direction. In VVC, several conventional angular intra-prediction modes may be adaptively replaced with wide-angle intra-prediction modes for non-square blocks. The replaced modes may be signaled using the original mode indexes, which are remapped to the indexes of wide angular modes after parsing. In some examples, the total number of intra-prediction modes may be unchanged, i.e., 67, and the intra mode coding method may also be unchanged.

FIGS. 7 and 8 are reference example diagrams 700 and 800 of wide-angular intra-prediction. In some examples, the number of replaced modes in wide-angular direction mode may depend on the aspect ratio of a block. The replaced intra-prediction modes are illustrated in Table 1:

TABLE 1 Intra-prediction modes replaced by wide-angular modes Aspect ratio Replaced intra-prediction modes W/H == 16 Modes 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 W/H == 8 Modes 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 W/H == 4 Modes 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 W/H == 2 Modes 2, 3, 4, 5, 6, 7, 8, 9 W/H == 1 None W/H == ½ Modes 59, 60, 61, 62, 63, 64, 65, 66 W/H == ¼ Mode 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 W/H == ⅛ Modes 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66 W/H == 1/16 Modes 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66

FIG. 9 is a diagram 900 of discontinuity in case of directions that exceed 45° angle. In such instance, two vertically adjacent predicted samples may use two non-adjacent reference samples in the case of wide-angle intra-prediction. Hence, low-pass reference samples filter and side smoothing may be applied to the wide-angle prediction to reduce the negative effect of the increased gap Δp_(α). If a wide-angle mode represents a non-fractional offset, there may be 8 modes in the wide-angle modes satisfy this condition, which are [−14, −12, −10, −6, 72, 76, 78, 80]. When a block is predicted by these modes, the samples in the reference buffer can be directly copied without applying any interpolation. With this modification, the number of samples to be smoothed may be reduced.

In VVC, 4:2:2 and 4:4:4 chroma formats are supported as well as 4:2:0. Chroma derived mode (DM) derivation table for 4:2:2 chroma format was initially ported from HEVC extending the number of entries from 35 to 67 to align with the extension of intra-prediction modes. As HEVC specification does not support prediction angle below −135 degree and above 45 degree, luma intra-prediction modes ranging from 2 to 5 may be mapped to 2. Therefore, chroma DM derivation table for 4:2:2: chroma format can be updated by replacing some values of the entries of the mapping table to convert prediction angle more precisely for chroma blocks.

In some aspects, for each inter-predicted CU, motion parameters consisting of motion vectors, reference picture indices and reference picture list usage index, and additional information used for the new coding feature of VVC may be used for inter-predicted sample generation. The motion parameter can be signaled in an explicit or implicit manner. When a CU is coded with skip mode, the CU may be associated with one PU and may have no significant residual coefficients, no coded motion vector delta or reference picture index. A merge mode may be specified where the motion parameters for the current CU can be obtained from neighboring CUs, including spatial and temporal candidates, and additional schedules introduced in VVC. The merge mode can be applied to any inter-predicted CU, not only for skip mode. The alternative to merge mode may be the explicit transmission of motion parameters, where motion vector, corresponding reference picture index for each reference picture list and reference picture list usage flag and other needed information are signaled explicitly per each CU.

Additionally or alternatively, intra block copy (IBC) may be a tool adopted in HEVC extensions on SCC, and thus may be used by a video encoder 114, 200, 400, as described herein in encoding video, and/or by a video decoder 124, 300, 400, as described herein in decoding video. Such a tool may improve the coding efficiency of screen content materials. As IBC mode may be implemented as a block level coding mode, block matching (BM) may be performed at the encoder to find the optimal block vector (or motion vector) for each CU. Here, a block vector is used to indicate the displacement from the current block to a reference block, which is already reconstructed inside the current picture. The luma block vector of an IBC-coded CU may be in integer precision. The chroma block vector can round to integer precision as well. When combined with AMVR, the IBC mode can switch between 1-pel and 4-pel motion vector precisions. An IBC-coded CU may be treated as the third prediction mode other than intra- or inter-prediction modes. The IBC mode may be applicable to the CUs with both width and height smaller than or equal to 64 luma samples.

At the encoder side, hash-based motion estimation may be performed for IBC. The encoder performs RD check for blocks with either width or height no larger than 16 luma samples. For non-merge mode, the block vector search may be performed using hash-based search first. If hash search does not return valid candidate, block matching based local search may be performed. In the hash-based search, hash key matching (32-bit cyclic redundancy check (CRC)) between the current block and a reference block may be extended to all allowed block sizes. The hash key calculation for every position in the current picture may be based on 4×4 sub-blocks. For the current block of a larger size, a hash key may be determined to match that of the reference block when all the hash keys of all 4×4 sub-blocks match the hash keys in the corresponding reference locations. If hash keys of multiple reference blocks are found to match that of the current block, the block vector costs of each matched reference may be calculated and the one with the minimum cost may be selected.

In some examples, in block matching search, the search range may be set to cover both the previous and current CTUs. At CU level, IBC mode may be signaled with a flag and it can be signaled as IBC AMVP mode or IBC skip/merge mode. In one example, such as IBC skip/merge mode, a merge candidate index may be used to indicate which of the block vectors in the list from neighboring candidate IBC coded blocks is used to predict the current block. The merge list may include spatial, HMVP, and pairwise candidates.

In another example, such as IBC AMVP mode, a block vector difference may be coded in the same way as a motion vector difference. The block vector prediction method uses two candidates as predictors, one from left neighbor and one from above neighbor (if IBC coded). When either neighbor is not available, a default block vector can be used as a predictor. A flag can be signaled to indicate the block vector predictor index.

To reduce the cross-component redundancy, a cross-component linear model (CCLM) prediction mode may be used in the VVC, for which the chroma samples are predicted based on the reconstructed luma samples of the same CU by using a linear model as follows:

pred_(C)(i, j)=α·rec_(L)′(i, j)+β  Equation 1

In such instance, pred_(C)(i, j) may represent the predicted chroma samples in a CU and rec_(L)(i, j) may represent the down-sampled reconstructed luma samples of the same CU. The CCLM parameters (α and β) may be derived with at most four neighboring chroma samples and their corresponding down-sampled luma samples. For instance, suppose the current chroma block dimensions are W×H, then W″ and H′ are set as W′=W, H′=H when LM mode is applied; W′=W+H when LM-T mode is applied; and H′=H+W when LM-L mode is applied.

The above neighboring positions may be denoted as S[0, −1] . . . S[W′−1, −1] and the left neighboring positions may be denoted as S[−1, 0] . . . S[−1, H′−1]. Then the four samples are selected as S[W′/4, −1], S[3*W′/4, −1], S[−1, H′/4], S[−1, 3*H′/4] when LM mode is applied and both above and left neighboring samples are available; S[W′/8, −1], S[3*W′/8, −1], S[5*W′/8, −1], S[7*W′/8, −1] when LM-T mode is applied or only the above neighboring samples are available; and S[−1, H′/8], S[−1, 3*H′/8], S[−1, 5*H′/8], S[−1, 7*H′/8] when LM-L mode is applied or only the left neighboring samples are available.

In some aspects, the four neighboring luma samples at the selected positions may be down-sampled and compared four times to find two larger values: x⁰ _(A) and x¹ _(A), and two smaller values: x⁰ _(B) and x¹ _(B). Their corresponding chroma sample values may be denoted as y⁰ _(A), y¹ _(A), y⁰ _(B) and y¹ _(B). Then x_(A), x_(B), y_(A) and y_(B) may be derived as:

X _(a)=(x ⁰ _(A) +x ¹ _(A)+1)>>1; X _(b)=(x ⁰ _(B) +x ¹ _(B)+1)>>1; Y _(a)=(y ⁰ _(A) +y ¹ _(A)+1)>>1; Y _(b)=(y ⁰ _(B) +y ¹ _(B)+1)>>1  Equation 2

Finally, the linear model parameters α and β may be obtained according to the following equations:

$\begin{matrix} {\alpha = \frac{Y_{a} - Y_{b}}{X_{a} - X_{b}}} & {{Equation}\mspace{14mu} 3} \\ {\beta = {Y_{b} - {\alpha \cdot X_{b}}}} & {{Equation}\mspace{14mu} 4} \end{matrix}$

FIG. 10 is a schematic diagram 1000 of location of the samples used for the derivation of α and β for the chroma. FIG. 11 is a schematic diagram 1100 of location of the samples used for the derivation of α and β for the luma. For both FIGS. 10 and 11, the division operation to calculate parameter α may be implemented with a look-up table. To reduce the memory required for storing the table, the diff value (difference between maximum and minimum values) and the parameter α may be expressed by an exponential notation. For example, the diff value is approximated with a 4-bit significant part and an exponent. Consequently, the table for 1/diff is reduced into 16 elements for 16 values of the significand as follows:

TABLE 2 DivTable [ ] = {0, 7, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 1, 1, 0}

In an example, the above template and left template can be used to calculate the linear model coefficients together. In another example, the above template and left template can be used alternatively in the other 2 LM modes, called LM_T, and LM_L modes. In LM_T mode, only the above template may be used to calculate the linear model coefficients. To get more samples, the above template is extended to (W+H) samples. In LM_L mode, only left template is used to calculate the linear model coefficients. To get more samples, the left template may be extended to (H+W) samples. In LM mode, left and above templates are used to calculate the linear model coefficients.

To match the chroma sample locations for 4:2:0 video sequences, two types of down-sampling filter are applied to luma samples to achieve 2 to 1 down-sampling ratio in both horizontal and vertical directions. The selection of down-sampling filter is specified by a SPS level flag. The two down-sampling filters are as follows, which are corresponding to “type-0” and “type-2” content, respectively.

$\begin{matrix} {{{Rec}_{L}^{\prime}\left( {i,j} \right)} = {\quad{\begin{bmatrix} {{{rec}_{L}\left( {{{2i} - 1},{{2j} - 1}} \right)} + {2 \cdot {{rec}_{L}\left( {{{2i} - 1},{{2j} - 1}} \right)}} +} \\ {{{rec}_{L}\left( {{{2i} + 1},{{2j} - 1}} \right)} + {{rec}_{L}\left( {{{2i} - 1},{2j}} \right)} + {2 \cdot}} \\ {{{rec}_{L}\left( {{2i},{2j}} \right)} + {{rec}_{L}\left( {{{2i} + 1},{2j}} \right)} + 4} \end{bmatrix} ⪢ 3}}} & {{Equation}\mspace{14mu} 5} \\ {{{rec}_{L}^{\prime}\left( {i,j} \right)} = {\begin{bmatrix} {{{rec}_{L}\left( {{2i},{{2j} - 1}} \right)} + {{rec}_{L}\left( {{{2i} - 1},{2j}} \right)} + {4 \cdot}} \\ {{{rec}_{L}\left( {{2i},{2j}} \right)} + {{rec}_{L}\left( {{{2i} + 1},{2j}} \right)} +} \\ {{{rec}_{L}\left( {{2i},{{2j} + 1}} \right)} + 4} \end{bmatrix} ⪢ 3}} & {{Equation}\mspace{14mu} 6} \end{matrix}$

Note that only one luma line (general line buffer in intra-prediction) may be used to make the down-sampled luma samples when the upper reference line is at the CTU boundary. This parameter computation may be performed as part of the decoding process, and not just as an encoder search operation. As a result, no syntax may be used to convey the α and β values to the decoder.

For chroma intra-prediction mode coding, a total of 8 intra-prediction modes are allowed for chroma intra mode coding. Those modes include five traditional intra-prediction modes and three cross-component linear model modes (LM, LM_T, and LM_L). Chroma mode signaling and derivation process are shown in Table 3 below. Chroma mode coding directly depends on the intra-prediction mode of the corresponding luma block. As separate block partitioning structure for luma and chroma components is enabled in I slices, one chroma block may correspond to multiple luma blocks. Therefore, for Chroma DM mode, the intra-prediction mode of the corresponding luma block covering the center position of the current chroma block can be directly inherited.

TABLE 3 Chroma mode signalling and derivation process Chroma prediction Corresponding luma intra-prediction mode mode 0 50 18 1 X (0 <= X <= 66) 0 66 0 0 0 0 1 50 66 50 50 50 2 18 18 66 18 18 3 1 1 1 66 1 4 0 50 18 1 X 5 81 81 81 81 81 6 82 82 82 82 82 7 83 83 83 83 83

TABLE 4 Unified binarization table for chroma prediction mode Value of intra_chroma_pred_mode Bin string 4 00 0 0100 1 0101 2 0110 3 0111 5 10 6 110 7 111

In Table 4, the first bin indicates whether it is regular (0) or LM modes (1). If it is LM mode, then the next bin indicates whether it is LM_CHROMA (0) or not (1). If it is not LM_CHROMA, next bin indicates whether it is LM_L (0) or LM_T (1). For this case, when sps_cclm_enabled_flag is 0, the first bin of the binarization table for the corresponding intra_chroma_pred_mode can be discarded prior to the entropy coding. In other words, the first bin is inferred to be 0 and hence not coded. This single binarization table is used for both sps_cclm_enabled_flag equal to 0 and 1 cases. The first two bins in Table 4 are context coded with its own context model, and the rest of the bins are bypass coded.

In addition, in order to reduce luma-chroma latency in dual tree, when the 64×64 luma coding tree node is partitioned with Not Split (and ISP is not used for the 64×64 CU) or QT, the chroma CUs in 32×32/32×16 chroma coding tree node is allowed to use CCLM in the following way: If the 32×32 chroma node is not split or partitioned QT split, all chroma CUs in the 32×32 node can use CCLM; Alternatively, if the 32×32 chroma node is partitioned with Horizontal BT, and the 32×16 child node does not split or uses Vertical BT split, all chroma CUs in the 32×16 chroma node can use CCLM. In all the other luma and chroma coding tree split conditions, CCLM is not allowed for chroma CU.

In VVC, the results of intra-prediction of DC, planar and several angular modes may further be modified by a position dependent prediction combination (PDPC) method. PDPC is a prediction method that invokes a combination of the boundary reference samples and HEVC style prediction with filtered boundary reference samples. PDPC can be applied to the following intra modes without signaling: planar, DC, intra angles less than or equal to horizontal, and intra angles greater than or equal to vertical and less than or equal to 80. If the current block is BDPCM mode or MRL index is larger than 0, PDPC is not applied.

The prediction sample pred(x′,y′) is predicted using an intra-prediction mode (DC, planar, angular) and a linear combination of reference samples according to the Equation 7 as follows:

pred(x′,y′)=Clip(0, (1<<BitDepth)−1, (wL×R _(-1,y′) +wT×R _(x′,-1)+(64−wL−wT)×pred(x′,y′)+32)>>6)  Equation 7

In the above equation, R_(x,-1), R_(-1,y) may represent the reference samples located at the top and left boundaries of current sample (x, y), respectively

In some aspects, if PDPC is applied to DC, planar, horizontal, and vertical intra modes, additional boundary filters may not be needed, as currently required in the case of HEVC DC mode boundary filter or horizontal/vertical mode edge filters. PDPC process for DC and planar modes is identical. For angular modes, if the current angular mode is HOR_IDX or VER_IDX, left or top reference samples is not used, respectively. The PDPC weights and scale factors are dependent on prediction modes and the block sizes. PDPC is applied to the block with both width and height greater than or equal to 4.

FIGS. 12-15 illustrate examples of reference samples 1200, 1300, 1400, 1500 (R_(x,-1) and R_(-1,y)) for PDPC applied over various prediction modes. The prediction sample pred(x′, y′) is located at (x′, y′) within the prediction block. As an example, the coordinate x of the reference sample R_(x,-1) is given by: x=x′+y′+1, and the coordinate y of the reference sample R_(-1,y) is similarly given by: y=x′+y′+1 for the diagonal modes. For the other angular mode, the reference samples R_(x,-1) and R_(-1,y) could be located in fractional sample position. In this case, the sample value of the nearest integer sample location is used.

FIG. 16 is a diagram 1600 of multiple reference line (MRL) intra-prediction used in accordance with aspects of the present disclosure. In some examples, the samples of segments A and F are not fetched from reconstructed neighboring samples but padded with the closest samples from Segment B and E, respectively. HEVC intra-picture prediction uses the nearest reference line (i.e., reference line 0). In MRL, 2 additional lines (reference line 1 and reference line 3) are used.

In some examples of video coding, the index of selected reference line (mrl_idx) can be signalled and used to generate intra predictor. For reference line index, which is greater than 0, the most probable mode (MPM) list may only include additional reference line modes and the MPM index can be signalled without remaining modes. The reference line index can be signalled before intra-prediction modes, and planar mode can be excluded from intra-prediction modes in case a non-zero reference line index is signaled.

MRL can be disabled for the first line of blocks inside a CTU to prevent using extended reference samples outside the current CTU line. Also, PDPC can be disabled when an additional line is used. For MRL mode, the derivation of DC value in DC intra-prediction mode for non-zero reference line indices can be aligned with that of reference line index 0. MRL may store 3 neighboring luma reference lines with a CTU to generate predictions. The Cross-Component Linear Model (CCLM) tool may store 3 neighboring luma reference lines for its down-sampling filters. The definition of MRL to use the same 3 lines can be aligned as CCLM to reduce the storage requirements for decoders.

FIGS. 17 and 18 are examples of diagrams 1700 and 1800 of an intra sub-partitions (ISP) that divides luma intra-predicted blocks vertically or horizontally into sub-partitions depending on the block size. For example, minimum block size for ISP is 4×8 (or 8×4). If block size is greater than 4×8 (or 8×4) then the corresponding block can be divided by 4 sub-partitions. It has been noted that the M×128 (with M≤64) and 128×N (with N≤64) ISP blocks could generate a potential issue with the 64×64 VDPU. For example, an M×128 CU in the single tree case has an M×128 luma TB and two corresponding M/2×64 chroma TBs. If the CU uses ISP, then the luma TB can be divided into four M×32 TBs (only the horizontal split is possible), each of them smaller than a 64×64 block. However, in the current design of ISP chroma blocks are not divided. Therefore, both chroma components may have a size greater than a 32×32 block. Analogously, a similar situation could be created with a 128×N CU using ISP. Hence, these two cases may be an issue for the 64×64 decoder pipeline. For this reason, the CU sizes that can use ISP may be restricted to a maximum of 64×64. FIGS. 17 and 18 shows examples of the two possibilities. All sub-partitions fulfill the condition of having at least 16 samples.

In ISP, the dependence of 1×N/2×N subblock prediction on the reconstructed values of previously decoded 1×N/2×N subblocks of the coding block is not allowed so that the minimum width of prediction for subblocks becomes four samples. For example, an 8×N (N>4) coding block that is coded using ISP with vertical split is split into two prediction regions each of size 4×N and four transforms of size 2×N. Also, a 4×N coding block that is coded using ISP with vertical split is predicted using the full 4×N block; four transform each of 1×N is used. Although the transform sizes of 1×N and 2×N are allowed, it is asserted that the transform of these blocks in 4×N regions can be performed in parallel. For example, when a 4×N prediction region contains four 1×N transforms, there is no transform in the horizontal direction; the transform in the vertical direction can be performed as a single 4×N transform in the vertical direction. Similarly, when a 4×N prediction region contains two 2×N transform blocks, the transform operation of the two 2×N blocks in each direction (horizontal and vertical) can be conducted in parallel. In this example, there may be no delay, or reduced delay, added in processing these smaller blocks than processing 4×4 regular-coded intra blocks.

TABLE 5 Block Size Coefficient group Size 1 × N, N ≥ 16  1 × 16 N × 1, N ≥ 16 16 × 1  2 × N, N ≥ 8  2 × 8 N × 2, N ≥ 8  8 × 2 All other possible M × N cases 4 × 4

For each sub-partition, reconstructed samples are obtained by adding the residual signal to the prediction signal. Here, a residual signal is generated by the processes such as entropy decoding, inverse quantization and inverse transform. Therefore, the reconstructed sample values of each sub-partition can be available to generate the prediction of the next sub-partition, and each sub-partition is repeatedly processed. In addition, the first sub-partition to be processed is the one containing the top-left sample of the CU and then continuing downwards (horizontal split) or rightwards (vertical split). As a result, reference samples used to generate the sub-partitions prediction signals may only be located at the left and above sides of the lines. All sub-partitions can share the same intra mode. The followings are summary of interaction of ISP with other coding tools.

In one example, MRL may be implemented if a block has an MRL index other than 0, then the ISP coding mode can be inferred to be 0 and therefore ISP mode information may not be sent to the decoder. In another example, entropy coding coefficient group size may be selected if the sizes of the entropy coding subblocks have been modified so that they have 16 samples in all possible cases, as shown in Table 5. Note that the new sizes may only affect blocks produced by ISP in which one of the dimensions is less than 4 samples. In all other cases coefficient groups may keep the 4×4 dimensions.

Additionally or alternatively, with respect to coded block flag (CBF) coding, it is assumed to have at least one of the sub-partitions has a non-zero CBF. Hence, if n is the number of sub-partitions and the first n−1 sub-partitions have produced a zero CBF, then the CBF of the n-th sub-partition can be inferred to be 1. Transform size restriction: all ISP transforms with a length larger than 16 points can use the discrete cosine transform (DCT)-II. Multiple transform selection (MTS) flag: if a CU uses the ISP coding mode, the MTS CU flag may be set to 0 and it may not be sent to the decoder. Therefore, the encoder may not perform rate distortion (RD) tests for the different available transforms for each resulting sub-partition. The transform choice for the ISP mode may instead be fixed and selected according the intra mode, the processing order and the block size utilized. Hence, no signaling may be required, in this example.

For example, let t_(H) and t_(V) be the horizontal and the vertical transforms selected respectively for the w×h sub-partition, where w is the width and h is the height. Then the transform can be selected according to the following rules: If w=1 or h=1, then there may be no horizontal or vertical transform respectively. If w≥4 and w≤16, t_(H)=discrete sine transform (DST)-VII, otherwise, t_(H)=DCT-II. If h≥4 and h≤16, t_(V)=DST-VII, otherwise, t_(V)=DCT-II.

In ISP mode, all 67 intra-prediction modes are allowed. PDPC can also be applied if corresponding width and height is at least 4 samples long. In addition, the reference sample filtering process (reference smoothing) and the condition for intra interpolation filter selection may not exist anymore, and Cubic (DCT-IF) filter can be applied for fractional position interpolation in ISP mode.

FIG. 19 is an example of a diagram 1900 of matrix weighted intra-prediction process (MIP) for VVC. For predicting the samples of a rectangular block of width W and height H, -MIP takes one line of H reconstructed neighboring boundary samples left of the block and one line of W reconstructed neighboring boundary samples above the block as input. If the reconstructed samples are unavailable, they can be generated as in the conventional intra-prediction.

Among the boundary samples, four samples or eight samples can be selected by averaging based on block size and shape. Specifically, the input boundaries bdry^(top) and bdry^(left) are reduced to smaller boundaries bdry_(red) ^(top) and bdry_(red) ^(left) by averaging neighboring boundary samples according to predefined rule depends on block size. Then, the two reduced boundaries bdry_(red) ^(top) and bdry_(red) ^(left) can be concatenated to a reduced boundary vector bdry_(red) which is thus of size four for blocks of shape 4×4 and of size eight for blocks of all other shapes. If mode refers to the MIP-mode, this concatenation is defined as follows:

$\begin{matrix} {{bdry}_{red} = \left\{ \begin{matrix} \left\lbrack {{bdry}_{red}^{top},{bdry}_{red}^{left}} \right\rbrack & {{{for}\mspace{14mu} W} = {H = {{4\mspace{14mu}{and}\mspace{14mu}{mode}} < 18}}} \\ \left\lbrack {{bdry}_{red}^{left},{bdry}_{red}^{top}} \right\rbrack & {{{for}\mspace{14mu} W} = {H = {{4\mspace{14mu}{and}\mspace{14mu}{mode}} \geq 18}}} \\ \left\lbrack {{bdry}_{red}^{top},{bdry}_{red}^{left}} \right\rbrack & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} = {{8\mspace{20mu}{and}\mspace{14mu}{mode}} < 10}} \\ \left\lbrack {{bdry}_{red}^{left},{bdry}_{red}^{top}} \right\rbrack & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} = {{8\mspace{14mu}{and}\mspace{14mu}{mode}} \geq 10}} \\ \left\lbrack {{bdry}_{red}^{top},{bdry}_{red}^{left}} \right\rbrack & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} > {8\mspace{14mu}{and}\mspace{14mu}{mode}} < 6} \\ \left\lbrack {{bdry}_{red}^{left},{bdry}_{red}^{top}} \right\rbrack & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} > {8\mspace{14mu}{and}\mspace{14mu}{mode}} \geq 6.} \end{matrix} \right.} & {{Equation}\mspace{14mu} 8} \end{matrix}$

A matrix vector multiplication, followed by addition of an offset, is carried out with the averaged samples as an input. The result is a reduced prediction signal on a subsampled set of samples in the original block. Out of the reduced input vector bdry_(red) a reduced prediction signal pred_(red,) which is a signal on the down-sampled block of width W_(red) and height H_(red) is generated. Here, W_(red) and H_(red) are defined as:

$\begin{matrix} {W_{red} = \left\{ {{\begin{matrix} 4 & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} \leq 8} \\ {\min\left( {W,8} \right)} & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} > 8} \end{matrix}H_{red}} = \left\{ \begin{matrix} 4 & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} \leq 8} \\ {\min\left( {H,8} \right)} & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} > 8} \end{matrix} \right.} \right.} & {{Equation}\mspace{14mu} 9} \end{matrix}$

The reduced prediction signal pred_(red) may be computed by calculating a matrix vector product and adding an offset:

pred_(red) =A·bdry_(red) +b  Equation 10

Here, A is a matrix that has W_(red)·H_(red) rows and 4 columns if W=H=4 and 8 columns in all other cases. b is a vector of size W_(red)·H_(red). The matrix A and the offset vector b are taken from one of the sets S₀, S₁, S₂. One defines an index idx=idx(W, H) as follows:

$\begin{matrix} {{{idx}\left( {W,H} \right)} = \left\{ \begin{matrix} 0 & {{{for}\mspace{14mu} W} = {H = 4}} \\ 1 & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} = 8} \\ 2 & {{{for}\mspace{14mu}{\max\left( {W,H} \right)}} > 8.} \end{matrix} \right.} & {{Equation}\mspace{14mu} 11} \end{matrix}$

Here, each coefficient of the matrix A is represented with 8 bit precision. The set S₀ consists of 16 matrices A₀ ^(i), i∈{0, . . . , 15} each of which has 16 rows and 4 columns and 16 offset vectors b₀ ^(i), i∈{0, . . . , 16} each of size 16. Matrices and offset vectors of that set are used for blocks of size 4×4. The set S₁ consists of 8 matrices A₁ ^(i), i∈{0, . . . , 7}, each of which has 16 rows and 8 columns and 8 offset vectors b₁ ^(i), i∈{0, . . . , 7} each of size 16. The set S₂ consists of 6 matrices A₂ ^(i), i∈{0, . . . , 5}, each of which has 64 rows and 8 columns and of 6 offset vectors b₂ ^(i), i∈{0, . . . , 5} of size 64.

In some examples, the prediction signal at the remaining positions may be generated from the prediction signal on the subsampled set by linear interpolation which is a single step linear interpolation in each direction. The interpolation can be firstly performed in the horizontal direction and then in the vertical direction regardless of block shape or block size.

For each CU in intra mode, a flag indicating whether an MIP mode may be to be applied or not is sent. If an MIP mode is to be applied, MW mode (predModeIntra) may be signaled. For an MIP mode, a transposed flag (isTransposed), which determines whether the mode is transposed, and MW mode ID (modeId), which determines which matrix is to be used for the given MW mode, can be derived as follows

isTransposed=predModeIntra&1

modeId=predModeIntra>>1  Equation 12

MW coding mode may be harmonized with other coding tools by considering following aspects: (1) low-frequency non-separable transform (LFNST) is enabled for MIP on large blocks. Here, the LFNST transforms of planar mode are used; (2) the reference sample derivation for MW is performed exactly or at least similarly as for the conventional intra-prediction modes; (3) for the up-sampling step used in the MIP-prediction, original reference samples are used instead of down-sampled ones; (4) clipping is performed before up-sampling and not after up-sampling; (5) MIP may be allowed up to 64×64 regardless of the maximum transform size. In some aspects, the number of MIP modes may be 32 for sizeId=0, 16 for sizeId=1 and 12 for sizeId=2.

In joint exploration model (JEM)-2.0 intra modes are extended to 67 from 35 modes in HEVC, and they are derived at encoder and explicitly signaled to decoder. A significant amount of overhead is spent on intra mode coding in JEM-2.0. For example, the intra mode signaling overhead may be up to 5˜10% of overall bitrate in all intra coding configuration. This contribution proposes the decoder-side intra mode derivation approach to reduce the intra mode coding overhead while keeping prediction accuracy. To reduce the overhead of intra mode signaling, a decoder-side intra mode derivation (DIMD) approach, which may be used by video decoders 124, 300, 400 in decoding video. In accordance with aspects of the present disclosure, instead of signaling intra mode explicitly, the information can be derived at both encoder and decoder from the neighboring reconstructed samples of current block. The intra mode derived by DIMD may be used in two ways, for example: 1) For 2N×2N CUs, the DIMD mode is used as the intra mode for intra-prediction when the corresponding CU-level DIMD flag is turned on; 2) For N×N CUs, the DIMD mode is used to replace one candidate of the existing MPM list to improve the efficiency of intra mode coding.

FIG. 20 is an example of a diagram 2000 of a template based intra mode derivation where the target denotes the current block (of block size N) for which intra-prediction mode is to be estimated. The template (indicated by the patterned region in FIG. 20) specifies a set of already reconstructed samples, which are used to derive the intra mode. The template size is denoted as the number of samples within the template that extends to the above and the left of the target block, i.e., L. In some implementations, a template size of 2 (i.e., L=2) can be used for 4×4 and 8×8 blocks and a template size of 4 (i.e., L=4) can be used for 16×16 and larger blocks. The reference of template (indicated by the dotted region in FIG. 20) can refer to a set of neighboring samples from above and left of the template, as defined by JEM-2.0. Unlike the template samples which are always from reconstructed region, the reference samples of template may not be reconstructed yet when encoding/decoding the target block. In this case, the existing reference samples substitution algorithm of JEM-2.0 is utilized to substitute the unavailable reference samples with the available reference samples.

For each intra-prediction mode, the DIMD calculates the absolute difference (SAD) between the reconstructed template samples and its prediction samples obtained from the reference samples of the template. The intra-prediction mode that yields the minimum SAD may be selected as the final intra-prediction mode of the target block.

For intra 2N×2N CUs, the DIMD can be used as one additional intra mode, which can be adaptively selected by comparing the DIMD intra mode with the optimal normal intra mode (i.e., being explicitly signaled). One flag is signaled for each intra 2N×2N CU to indicate the usage of the DIMD. If the flag is one, then the CU can be predicted using the intra mode derived by DIMD; otherwise, the DIMD is not applied and the CU is predicted using the intra mode explicitly signaled in the bit-stream. When the DIMD is enabled, chroma components can reuse the same intra mode as that derived for luma component, i.e., DM mode.

Additionally, for each DIMD-coded CU, the blocks in the CU can adaptively select to derive their intra modes at either PU-level or TU-level. Specifically, when the DIMD flag is one, another CU-level DIMD control flag can be signaled to indicate the level at which the DIMD is performed. If this flag is zero, this can indicate that the DIMD is performed at the PU level and all the TUs in the PU use the same derived intra mode for their intra-prediction; otherwise if the DIMD control flag is one, this can indicate that the DIMD is performed at the TU level and each TU in the PU derives its own intra mode.

Further, when the DIMD is enabled, the number of angular directions increases to 129, and the DC and planar modes still remain the same. To accommodate the increased granularity of angular intra modes, the precision of intra interpolation filtering for DIMD-coded CUs increases from 1/32-pel to 1/64-pel. Additionally, in order to use the derived intra mode of a DIMD coded CU as MPM candidate for neighboring intra blocks, those 129 directions of the DIMD-coded CUs can be converted to “normal” intra modes (i.e., 65 angular intra directions) before they are used as MPM.

In some aspects, intra modes of intra N×N CUs are signaled. However, to improve the efficiency of intra mode coding, the intra modes derived from DIMD are used as MPM candidates for predicting the intra modes of four PUs in the CU. In order to not increase the overhead of MPM index signaling, the DIMD candidate can be placed at the first place in the MPM list and the last existing MPM candidate can be removed. Also, a pruning operation can be performed such that the DIMD candidate may not be added to the MPM list if it is redundant.

In order to reduce encoding/decoding complexity, one straightforward fast intra mode search algorithm is used for DIMD. Firstly, one initial estimation process can be performed to provide a good starting point for intra mode search. Specifically, an initial candidate list can be created by selecting N fixed modes from the allowed intra modes. Then, the SAD can be calculated for all the candidate intra modes and the one that minimizes the SAD can be selected as the starting intra mode. To achieve a good complexity/performance trade-off, the initial candidate list can include 11 intra modes, including DC, planar and every 4-th mode of the 33 angular intra directions as defined in HEVC, i.e., intra modes 0, 1, 2, 6, 10 . . . 30, 34.

If the starting intra mode is either DC or planar, it can be used as the DIMD mode. Otherwise, based on the starting intra mode, one refinement process can then be applied where the optimal intra mode is identified through one iterative search. In the iterative search, at each iteration, the SAD values for three intra modes separated by a given search interval can be compared and the intra mode that minimizes the SAD can be maintained. The search interval can then be reduced to half, and the selected intra mode from the last iteration can serve as the center intra mode for the current iteration. For the current DIMD implementation with 129 angular intra directions, up to 4 iterations can be used in the refinement process to find the optimal DIMD intra mode.

In some examples, transmitting of the luma intra-prediction mode in the bitstream can be avoided. This is done by deriving the luma intra mode using previously encoded/decoded pixels, in an identical fashion at the encoder and at the decoder. This process defines a new coding mode called DIMD, whose selection signaled in the bitstream for intra coded blocks using a flag. DIMD can compete with other coding modes at the encoder, including the classic Intra coding mode (where the intra-prediction mode is coded). Note that in one example, DIMD may only apply to luma. For chroma, classical intra coding mode may apply. As done for other coding modes (classical intra, inter, merge, etc.), a rate-distortion cost can be computed for the DIMD mode, and can then be compared to the coding costs of other modes to decide whether to select it as final coding mode for a current block.

At the decoder side, the DIMD flag can be first parsed, if present. If the DIMD flag is true, the intra-prediction mode can be derived in the reconstruction process using the same previously encoded neighboring pixels. If not, the intra-prediction mode can be parsed from the bitstream as in classical intra coding mode.

To derive the intra-prediction mode for a block, a set of neighboring pixels may be first selected on which a gradient analysis is performed. For normativity purposes, these pixels can be in the decoded/reconstructed pool of pixels. FIG. 21 is an example of a diagram 2100 of a template of a set of chosen pixels on which a gradient analysis may be performed based on intra-prediction mode derivation. As shown in FIG. 21, a template surrounding the current block is chosen by T pixels to the left, and T pixels above. For example, T may have a value of 2.

Next, a gradient analysis is performed on the pixels of the template. This can facilitate determining a main angular direction for the template, which can be assumed to have a high chance to be identical to the one of the current block. Thus, a simple 3×3 Sobel gradient filter can be used, defined by the following matrices that may be convoluted with the template:

$M_{x} = {\begin{bmatrix} {- 1} & 0 & 1 \\ {- 2} & 0 & 2 \\ {- 1} & 0 & 1 \end{bmatrix}\mspace{14mu}{and}}$ $M_{y} = \begin{bmatrix} {- 1} & {- 2} & {- 1} \\ 0 & 0 & 0 \\ 1 & 2 & 1 \end{bmatrix}$

For each pixel of the template, each of these two matrices with the 3×3 window centered around the current pixel can be point-by-point multiplied and composed of its 8 direct neighbors, and the result can be is summed. Thus, two values G_(x) (from the multiplication with M_(x)), and G_(y) (from the multiplication with M_(y)) corresponding to the gradient at the current pixel can be obtained, in the horizontal and vertical direction respectively.

FIG. 22 is an example of a diagram of a convolution of a 3×3 Sobel gradient filter with the template in accordance with aspects of the present disclosure. In some examples, the pixel 2210 is the current pixel. Template pixels 2220 (including the current pixel 2210) are pixels on which the gradient analysis is possible. Unavailable pixels 2230 are pixels on which the gradient analysis is not possible due to lack of some neighbors. Reconstructed pixels 2240 are available pixels outside of the considered template, used in the gradient analysis of the template pixels 2220. In case a reconstructed pixel 2240 is not available (due to blocks being too close to the border of the picture for instance), the gradient analysis of all template pixels 2220 that use the unavailable reconstructed pixel 2240 is not performed.

For each template pixel 2220, the intensity (G) and the orientation (O) of the gradient using G_(x) and G_(y) are calculated as such:

$G = {{{G_{x}} + {{G_{y}}\mspace{14mu}{and}\mspace{14mu} O}} = {{atan}\left( \frac{G_{y}}{G_{x}} \right)}}$

Note that a fast implementation of the a tan function is proposed. The orientation of the gradient can then be converted into an intra angular prediction mode, used to index a histogram (first initialized to zero). The histogram value at that intra angular mode is increased by G. Once all the template pixels 2220 in the template have been processed, the histogram can include cumulative values of gradient intensities, for each intra angular mode. The mode that shows the highest peak in the histogram can be selected as intra-prediction mode for the current block. If the maximum value in the histogram is 0 (meaning no gradient analysis was able to be made, or the area composing the template is flat), then the DC mode can be selected as intra-prediction mode for the current block.

For blocks that are located at the top of CTUs, the gradient analysis of the pixels located in the top part of the template is not performed. The DIMD flag is coded using three possible contexts, depending on the left and above neighboring blocks, similarly to the Skip flag coding. Context 0 corresponds to the case where none of the left and above neighboring blocks are coded with DIMD mode, context 1 corresponds to the case where only one neighboring block is coded with DIMD, and context 2 corresponds to the case where both neighbors are DIMD-coded. Initial symbol probabilities for each context are set to 0.5.

One advantage that DIMD offers over classical intra mode coding is that the derived intra mode can have a higher precision, allowing more precise predictions at no additional cost as it is not transmitted in the bitstream. The derived intra mode spans 129 angular modes, hence a total of 130 modes including DC (e.g., the derived intra mode may not be planar in aspects described herein). The classical intra coding mode is unchanged, i.e., the prediction and mode coding still use 67 modes.

The required changes to Wide Angle Intra-prediction and simplified PDPC were performed to accommodate for prediction using 129 modes. Note that only the prediction process uses the extended intra modes, meaning that for any other purpose (deciding whether to filter the reference samples for instance), the mode can be converted back to 67-mode precision.

In the DIMD mode, the luma intra mode is derived during the reconstruction process, just prior to the block reconstruction. This is done to avoid a dependency on reconstructed pixels during parsing. However, by doing so, the luma intra mode of the block may be undefined for the chroma component of the block, and for the luma component of neighboring blocks. This can cause an issue because for chroma, a fixed mode candidate list is defined. Usually, if the luma mode equals one of the chroma candidates, that candidate may be replaced with the vertical diagonal (VDIA_IDX) intra mode. As in DIMD, the luma mode is unavailable, the initial chroma mode candidate list is not modified.

In classical intra mode, where the luma intra-prediction mode is to be parsed from the bitstream, an MPM list is constructed using the luma intra modes of neighboring blocks, which can be unavailable if those blocks were coded using DIMD. In this case, for example, DIMD-coded blocks can be treated as inter blocks during MPM list construction, meaning they are effectively considered unavailable.

Entropy coding may be a form of lossless compression used at the last stage of video encoding (and the first stage of video decoding), after the video has been reduced to a series of syntax elements. Syntax elements describe how the video sequence can be reconstructed at the decoder. This includes the method of prediction (e.g., spatial or temporal prediction, intra-prediction mode, and motion vectors) and prediction error, also referred to as residual. Arithmetic coding is a type of entropy coding that can achieve compression close to the entropy of a sequence by effectively mapping the symbols (i.e., syntax elements) to codewords with a non-integer number of bits. Context-adaptive binary arithmetic coding (CABAC) involves three main functions: binarization, context modeling, and arithmetic coding. Binarization maps the syntax elements to binary symbols (bins). Context modeling estimates the probability of the bins. Finally, arithmetic coding compresses the bins to bits based on the estimated probability.

Several different binarization processes are used in VVC, such as the truncated Rice (TR) binarization process, the truncated binary binarization process, the k-th order Exp-Golomb (EGk) binarization process and the fixed-length (FL) binarization process.

Context modeling provides an accurate probability estimate required to achieve high coding efficiency. Accordingly, it is highly adaptive and different context models can be used for different bins and the probability of that context model is updated based on the values of the previously coded bins. Bins with similar distributions often share the same context model. The context model for each bin can be selected based on the type of syntax element, bin position in syntax element (binIdx), luma/chroma, neighboring information, etc. A context switch can occur after each bin.

Arithmetic coding may be based on recursive interval division. A range, with an initial value of 0 to 1, is divided into two subintervals based on the probability of the bin. The encoded bits provide an offset that, when converted to a binary fraction, selects one of the two subintervals, which indicates the value of the decoded bin. After every decoded bin, the range is updated to equal the selected subinterval, and the interval division process repeats itself. The range and offset have limited bit precision, so renormalization may be used whenever the range falls below a certain value to prevent underflow. Renormalization can occur after each bin is decoded. Arithmetic coding can be done using an estimated probability (context coded), or assuming equal probability of 0.5 (bypass coded). For bypass coded bins, the division of the range into subintervals can be done by a shift, whereas a look up table may be used for the context coded bins.

FIG. 23 is a schematic diagram 2300 of intra mode coding with greater than 67 intra-prediction modes to capture the arbitrary edge directions presented in natural video. In some examples, the number of directional intra modes may be extended from 67, as used in VVC, to 129 while the planar and the DC modes remain the same.

In one example, the pre-defined IPMs may be the IPMs have denser directions than conventional IPMs (e.g., IPMs denoted by the dashed lines in FIG. 23). In one example, the N1 IPMs may be partial or full of the MPMs for the current block. In one example, some pre-defined intra-prediction modes which are not in MPMs may also be contained in the given IPM candidate set.

In one example, one or more IPMs from DC/Planar/horizontal/vertical/diagonal top-right/diagonal bottom-left/diagonal top-left modes may be contained in the given IPM set.

In one example, one or more IPMs denoted by the dashed lines in FIG. 23 may be contained in the given IPM set.

In one example, N1 may be equal to or larger than N2 when one or more IPMs denoted by the dashed red lines are contained in the given IPM set.

In one example, N1 may be equal to or larger than N2.

FIGS. 24-31 illustrate examples of templates that may be formed from one or more sub-templates. As discussed in further detail below, the template for a block may be selected for the specific block. For instance, the template may be selected based on decoded information about the specific block or based on availability of the sub-templates for the specific block. Although several examples are illustrated, other templates may be selected based on different combinations of the sub-templates.

FIG. 24 is a diagram of an example of a template 2400 including a left-above sub-template 2420 (Template-LA). The template 2400 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The left-above sub-template 2420 may include left-above neighboring samples that are located both to the left of the block 2410 and above the block 2410. The left-above sub-template 2420 may have dimensions of L1 samples horizontally and L2 samples vertically. L1 and L2 may be defined for the block 2400, a slice including the block 2400, or a picture including the block 2400.

FIG. 25 is a diagram of an example of a template 2500 including a left sub-template 2440 (Template-L) and an above sub-template 2430 (Template-A). The template 2500 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may be adjacent the top edge of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may be adjacent the top edge of the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically.

FIG. 26 is a diagram of an example of a template 2600 including the above sub-template 2430 (Template-A). The template 2600 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically.

FIG. 27 is a diagram of an example of a template 2700 including a left sub-template (Template-L). The template 2700 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically.

FIG. 28 is a diagram of an example of a template 2800 including the left sub-template 2440 (Template-L) and a left-below sub-template 2450 (Template-LB). The template 2800 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically. The left-below sub-template 2450 may include samples that are located both to the left of the block 2410 and below the block 2410. The left-below sub-template 2450 may have dimensions of L1 samples horizontally and N samples vertically.

FIG. 29 is a diagram of an example of a template 2900 including the above sub-template 2430 (Template-A) and a right-above sub-template 2460 (Template-RA). The template 2900 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically. The right-above sub-template 2460 may include samples located both above the block 2410 and to the right of the block 2410. The right-above sub-template 2460 may have dimensions of M samples horizontally and L2 samples vertically.

FIG. 30 is a diagram of an example of a template 3000 including the left sub-template 2440, the left-below sub-template 2450, the above sub-template 2430, and the right-above sub-template 2460. The template 3000 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically. The right-above sub-template 2460 may include samples located above and to the right of the block 2410. The right-above sub-template 2460 may have dimensions of M samples horizontally and L2 samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically. The left-below sub-template 2450 may include samples located to the left of the block 2410 and below the block 2410. The left-below sub-template 2450 may have dimensions of L1 samples horizontally and N samples vertically.

FIG. 31 is a diagram of an example of a template 3100 including the left-above sub-template 2420, the left sub-template 2440, the left-below sub-template 2450, the above sub-template 2430, and the right-above sub-template 2460. The template 3100 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The left-above sub-template 2420 may include samples located to the left and above the block 2410. The left-above sub-template 2420 may have dimensions of L1 samples horizontally and L2 samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically. The right-above sub-template 2460 may include samples located above and to the right of the block 2410. The right-above sub-template 2460 may have dimensions of M samples horizontally and L2 samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically. The left-below sub-template 2450 may include samples located to the left of and below the block 2410. The left-below sub-template 2450 may have dimensions of L1 samples horizontally and N samples vertically.

FIG. 32 is a diagram of an example of a template 3200 including a left-above sub-template 3220, a left sub-template 3240, a left-below sub-template 3260, an above sub-template 3230, and a right-above sub-template 3260 that are spaced apart from a block. The example template 3200 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. In contrast to the sub-templates in FIGS. 24-31, the sub-templates in FIG. 32 may be spaced apart from the block 2410. For example, the left-above sub-template 3220, the left sub-template 3240, and the left-below sub-template 3260 may be spaced horizontally apart from the block 2410 by a gap 3270. The gap 3270 may have a horizontal dimension of L3 samples. The left-above sub-template 2420, the above sub-template 2430, and the right-above sub-template 2460 may be spaced vertically apart from the block 2410 by a gap 3280. The gap 3280 may have a vertical dimension of L4 samples. In an aspect, each of the sub-templates 3220, 3230, 3240, 3250, 3260 may have dimensions that are the same as a corresponding sub-template 2420, 2430, 2440, 2450, 2460 in FIGS. 24-31. Accordingly, in FIG. 32, the locations of the sub-templates 3220, 3230, 3240, 3250, 3260 are different, but the size of the sub-templates 3220, 3230, 3240, 3250, 3260 may be the same as in FIGS. 24-31.

FIG. 33 is a diagram of examples of template-reference samples 3310 for a template 3300 including a left-above sub-template 2420, a left sub-template 2440, and an above sub-template 2430. The example template 3300 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The left-above sub-template 2420 may include samples located to the left and above the block 2410. The left-above sub-template 2420 may have dimensions of L1 samples horizontally and L2 samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically. The template-reference samples 3310 may be a single row of samples located above the template 3300 and a single column of samples located to the left of the template 3300. The row of samples may have a length of 2(L1+M)+1. The column of samples may have a height of 2(L2+N)+1.

FIG. 34 is a diagram of example template-reference samples 3410 for the template 2500 including the left sub-template 2440 and the above sub-template 2430. The example template 2500 may be selected for a block 2410, which may have dimensions of M samples horizontally and N samples vertically. The above sub-template 2430 may include samples located above the block 2410. The above sub-template 2430 may have dimensions of M samples horizontally and L2 samples vertically. The left sub-template 2440 may include samples located to the left of the block 2410. The left sub-template 2440 may have dimensions of L1 samples horizontally and N samples vertically. The template-reference samples may include one or more lines (e.g., rows or columns) of samples. For example, the template-reference samples 3410 may include a single row of samples located above the template 2500 and a single column of samples located to the left of the template 2500. The row of samples may have a length of 2(L1+M)+1. The column of samples may have a height of 2(L2+N)+1.

FIG. 35 is a diagram of example template-reference samples 3510 for the template 2600 including the above sub-template 2430. The template-reference samples 3510 may be a single row of samples located above the template 2600 and a single column of samples located to the left of the template 2600. The row of samples may have a length of 2M+1. The column of samples may have a height of 2(L2+N)+1.

FIG. 36 is a diagram of example template-reference samples 3610 for the template 2700 including the left sub-template 2440. The template-reference samples 3610 may be a single row of samples located above the template 2700 and a single column of samples located to the left of the template 2700. The row of samples may have a length of 2(L1+M)+1. The column of samples may have a height of 2N+1.

FIG. 37 is a diagram of example template-reference samples 3710 for the template 2600 including the above sub-template 2430. The template-reference samples 3710 may be a single row of samples located above the template 2600 and a single column of samples located to the left of the template 2600. The row of samples may have a length of 2(L1+M)+1. The column of samples may have a height of 2(L2+N)+1. Because the template 2600 does not include the left-above sub-template 2420 or the left sub-template 2440, the column of samples may be spaced from the template 2600 by a horizontal gap 3720 with a width of L1.

FIG. 38 is a diagram of example template-reference samples 3810 for the template 2700 including the left sub-template 2440. The template-reference samples 3810 may be a single row of samples located above the template 2700 and a single column of samples located to the left of the template 2700. The row of samples may have a length of 2(L1+M)+1. The column of samples may have a height of 2(L2+N)+1. Because the template 2700 does not include the left-above sub-template 2420 or the above sub-template 2430, the row of samples may be spaced from the template 2700 by a vertical gap 3820 with a height of L2.

FIG. 39 is a diagram of example template-reference samples 3910 for the template 2500 including the above sub-template 2430 and the left sub-template 2440. The template-reference samples 3910 may include a single column of samples located to the left of the template 2500. The column of samples may have a height of 2(L2+N)+1. Instead of a single row of template-reference samples, a portion 3920 of the row may be moved to a second row 3930 that is adjacent the left sub-template 2440. The portion 3920 may include L1 samples. The remaining portion in the first row may have a length of 2M+L1+1. In an aspect, selecting template-reference samples that are adjacent a sub-template included within the template may improve the prediction of the template.

FIG. 40 is a diagram of example template-reference samples 4010 for the template 2500 including the above sub-template 2430 and the left sub-template 2440. The template-reference samples 4010 may include a single row of samples located above the template 2500. The row of samples may have a length of 2(L1+M)+1. Instead of a single column of template-reference samples, a portion 4020 of the column may be moved to a second row 4030 that is adjacent the above sub-template 2430. The portion 4020 may include L2 samples. The remaining portion in the first column may have a height of 2N+L2+1. In an aspect, selecting template-reference samples that are adjacent a sub-template included within the template may improve the prediction of the template. In another aspect, both of the portion 3920 and the portion 4020 may be moved to the location 3930 and the location 4030, respectively.

Referring to FIG. 41, in operation, computing device 4102 may perform a method 4200 of video decoding, via execution of decoding component 4110 by processor 4104 and/or memory 4106, video decode 124, video decoder 300, or HEVC video encoder and decoder 400. The decoding component 4108 may receive an encoded bitstream 4146. The decoding component 4108 may perform a decoding operation (e.g., entropy decoding) to determine block information that may be provided to the variable template intra prediction unit 4110, which may include one or more of a bitstream construction component 4112 IPM deriving component 4114, IPM candidate set component 4116, and MPM list component 4118.

In some aspects, in order to minimize decoder complexity and latency in data processing of encoded bitstream 4146 due to signaling requirements of all intra prediction mode selections from the encoder, the decoding component 4108 may derive the IPM via the IPM deriving component 4114 from a subset of candidate IPMs 4116 of a set of all available candidate IPMs (e.g., 65 in VVC or 35 in HEVC). In one example, the IPM deriving component 4114 may select an IPM for a target block from a subset of candidate IPMs by calculating a cost between the prediction of reconstructed samples in a template and the reconstructed samples of the same. In some aspects, the IMP deriving component 4114 may select an IPM mode from the subset of candidate IPMs 4116 with the minimum cost as the derived intra prediction mode. Alternatively, for an IPM in subset of candidate IPMs 4116, a cost may be calculated according to the reconstructed samples in a template by using the gradient values for a given predicted direction associated with the IPM.

In some aspects, the subset of candidate IPMs 4116 may be configured based on decoded information (e.g., the block dimension, block shape, slice/picture type, etc.) associated with the received bitstream 4146. In other examples, for I slices/pictures, the subset of candidate IPMs 4116 may contain partial or full set of Most Probable Modes (MPMs) 4118 for the current block. For instance, for inter-coded slices/pictures, the subset of candidate IPMs 4116 may be set to the conventional IPM candidate set.

In some aspects, the number of IPMs in the subset of candidate IPMs 4116 may be N and the number of IPMs in the conventional IPM candidate set (e.g., for HEVC or VVC) may be M (e.g., N and M may be integers where N is less than M). In one example, the N IPMs may be the pre-defined IPMs which are from the conventional IPMs candidate set. In other examples, the N IPMs may be DC, planar, or IPMs with even mode number. In another example, the N IPMs may be DC, or/and planar, or/and IPMs with mode number being odd. In additional example, the N IPMs may be DC, planar, and/or IPMs with mode number equal to X, where X % m=0 and m is an integer (e.g., m=2, 3, 4, etc.). In yet another example, the N IPMs may contain DC, planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, and/or diagonal top-left mode. In one example, the pre-defined intra prediction modes in the given IPM candidate set may be different according to the decoded information, such as block dimension/block shape/slice type.

Alternatively, the pre-defined intra prediction modes may not be from the conventional IPM candidate set. In some aspects example, the pre-defined IPMs may be the IPMs that have denser directions than conventional IPMs. In some aspects example, some pre-defined IPMs are from the conventional IPMs candidate set and the other pre-defined IPMs are not from the conventional IPMs candidate set.

In one example, the N IPMs may be partial or full of the MPMs for the current block. In such instance, some pre-defined intra prediction modes which are not in MPMs may also be contained in the subset of candidate IPMs 4116. In one example, one or more IPMs from DC/Planar/horizontal/vertical/diagonal top-right/diagonal bottom-left/diagonal top-left modes may be contained in the subset of candidate IPMs 4116.

In one example, the intra prediction mode may be derived from the partial IPMs of the given IPM candidate set. In such instance, the IPM deriving component 4114 may denote the number of the partial IPMs of the given IPM candidate set as X. In one example, only partial IPMs from the given IPM candidate set may be used to derive the intra prediction mode (such as X is less than N). In one example, when partial or all IPMs in the conventional IPM candidate set may be replaced by several IPMs (e.g., wide-angle intra prediction modes), the derived IPM cannot be one of the replaced IPMs. Alternatively, the derived IPM may be one of the replaced IPMs.

In some aspects, all or partial IPMs in the subset of candidate IPMs 4116 may need to be checked when deriving the optimal IPM. In such instance, N may denote the total number of IPMs in the given IPM candidate set. In one example, all IPMs may need to be checked to derive the optimal IPM (e.g., full search). In such instance, not all IPMs in the subset of candidate IPMs 4116 may need to be checked to derive the optimal IPM. In one example, the IPMs in the given IPM candidate set may be re-ordered to assign a higher-possibility IPM candidate with a smaller index according to certain rules and the determination of derived IPM may be based on the re-ordered IPM candidate set. In other example, the ordering (or possibility) may be dependent on whether a mode is included in the MPM list 4118 of a current block and/or the order of modes in the MPM list 4118.

In one example, the ordering (or possibility) is dependent on whether a mode is associated with the neighbouring blocks. Alternatively, if a first IPM candidate with a smaller index has a smaller cost compared to a second IPM candidate with a larger index, then the determination process may be terminated and the first IPM candidate may be selected as the derived IPM. Alternatively, furthermore, if a first IPM candidate with a smaller index has a smaller cost compared to a second IPM candidate with a larger index and the absolute cost difference between the first and second IPM candidates is greater than a threshold, then the determination process may be terminated and the first IPM candidate may be selected as the derived IPM. In such instances, a multi-step searching method may be applied. Specifically, for a first step, a first sub-set of the given IPM candidate set may be searched to determine a second sub-set of given IPM candidate set to be searched in the next step. The selected IPM may then be determined in the final step.

For example, suppose the IPM candidates are denoted as M[0], M[1], . . . M[N−1]. In one example, in the first step (0-th step), the searching subset may include {M[k×L]}, where L is a pre-defined number such as 4 or 8 and k is integers from 0 to (N−1)/L. In one example, in the p-th step, the searching subset is {M[k×(L/2^(p))]}. The value of k may be in a range determined by the selected intra prediction mode in the (p−1)-th step. In one example, M[k₁×(L/2^(p))] may be the selected intra prediction mode in the (p−1)-th step, k may be equal to 2k1±T, where T is an odd number, such as T=1 or 3. In one example, k may be equal to K for all steps except 0-th step, such as K=2 or K=4.

In other examples, the process of searching one intra prediction mode may be skipped in the X-th step when the IPM has been searched in previous steps. Alternatively, furthermore, early termination may be used during the determination of the selected IPM. In one example, only IPMs with even mode number may be checked. Alternatively, only IPMs with odd mode number may be checked. In one example, a first IPM in the given IPM candidate set may be not checked when a second IPM has been checked when the absolute difference of mode number between the first IPM and the second IPM is less than or equal to V. V may be an integer. In other example, V may be equal to 1 or 2. In one example, one or more IPMs which are not in the given IPM candidate set may be further checked after the optimal IPM is derived. In some aspects, one or two neighbouring denser angular IPMs may be checked if the optimal IPM is an angular intra prediction mode.

In one example, the number of IPMs that need to be checked may depend on the decoded information (e.g., block dimensions).

In one example, when block width (BW)×block height (BH) is less than or equal to T1, N1 IPMs may need to be checked from subset of candidate IPMs 4116 and when BW×BH is larger than T1, N2 IPMs may need to be checked from a subset of candidate IPMs 4116. In one example, N1 may be less than, larger than, or equal to N2. In some aspects, T1 may be equal to 256. Alternatively, T1 may be equal to 512. In one example, N1 and N2 may be less than N.

In some situations, the mode searching procedure of DIMD executed by the IPM deriving component 4114 may also be terminated early after checking a mode candidate in the subset of candidate IPMs 4116. For instance, when the cost for a testing IPM candidate from the subset of candidate IPMs 4116 is less than or equal to C (where C is an integer), the IPM deriving component 4114 may elect to forego or omit checking the remaining IPM candidates. Instead, the IPM deriving component 4114 may select the IPM from the subset of candidate IPMs 4116 that is less than or equal to C as the optimal IPM for reconstructing the target block. In one example, C may be a pre-defined value, such as C=0 or C=10. In one example, the derivation of C may depend on the decoded information (e.g., block dimensions or/and the number of samples in the templates). In another example, C may be equal to h×(BW×BH), where his scale factor (e.g., h=1, or 2). In one example, C may be equal to s×N^(t), where s is scale factor (e.g., s=1, or 2, or 4) and N^(t) denotes the number of samples in the templates. In some aspects, different values of C may be set for different subset of IPM candidates. Additionally or alternatively, C1 may be used for the first subset of IPM candidates and C2 is used for the second subset of IPM candidates. C1 may be less than or equal to C2.

In some aspect, the first set of IPM candidates may consist of DC, planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode. And the second set of IPM candidates may consist of the other modes in the subset of candidate IPMs list 4116. In one example, the above early termination scheme may only be applied after some certain IPM candidates are checked. The certain mode candidates may refer to DC, planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, diagonal top-left mode. In one example, how to set the value of C may depend on the decoded information (e.g., slice/picture type). In above examples, the value of C may be set to the per-sample cost instead of the whole block's cost.

The number of IPMs from a subset of candidate IPMs 4116 that the IPM deriving component 4116 may test in order to derive the optimal IPM may depend on the decoded information such as slice/picture type, or/and temporal layer. In one example, the numbers of IPM candidates may need to be checked for different slice types.

For example, N1 and N2 reference the number of mode candidates for the first slice type and the second slice type. In one example, the first slice type may refer to I slice, and the second slice type may refer to P slice, or/and B slice. In one example, N1 may be equal to N2. Alternatively, the numbers of IPM candidates need to be checked for different slice types may be different. The value of N1 may be either less than or larger N2.

Additionally, in some aspects, the numbers of IPM candidates may need to be checked for different temporal layers. As an example, N3 and N4 denote the number of IPM candidates for the first temporal layer and the second temporal layer. In one example, the first temporal layer may refer to temporal layer TL1 and the second temporal layer refer to temporal layer TL2, where L1 is not equal to TL2 (e.g., TL1=0 and TL2=1). In some aspects, the value of N3 may be equal to N4. Alternatively, the number of IPM candidates within the subset of candidate IPMs 4116 may need to be checked for different temporal layers. In one example, N3 may be less than N4. Alternatively, N3 may be larger than N4. In some aspects, the indications of the set of IPMs that may need to be tested or checked to derive the optimal IPM may be signalled with a syntax element (e.g., SPS, PPS, picture header, slice header, CTU, CTU row, CU, etc.).

In some aspects, instead of using the predicted samples and the reconstructed samples of the template to calculate a cost for an IPM in the given IPM candidate set, the predicted samples may be filtered first, and the filtered predicted samples may be used to calculate the cost by the IPM deriving component 4114. In one example, the samples of the template, or/and the template-reference samples of the template may be used to filter the predicted samples of the template. In another example, the template-reference samples of the template may be unfiltered. Alternatively, the template-reference samples of the template may be filtered based on PDPC.

In some aspects, the filter may be applied to the predicted samples of the template for some selected IPMs from a subset of candidate IPMs. In one example, the selected IPMs may contain one or more of DC, planar, horizontal degree mode, vertical degree mode, diagonal top-right degree mode, diagonal bottom-left mode, or diagonal top-left mode. In one example, the selected IPMs may contain intra prediction modes derived from horizontal degree mode, or/and vertical degree mode, or/and diagonal top-right degree mode, or/and diagonal bottom-left mode, or/and diagonal top-left mode.

In some aspects, the derived intra prediction modes may depend on the distance of intra prediction mode number. The filter may be applied to the predicted samples of the template for all IPMs in the given IPM candidate set. Whether and/or how to apply the filter to the predicted samples of the template may depend on the decoded information. In one example, the decoded information may refer to block dimension or/and block shape of current block. In another example, the decoded information may refer to the decoded information of the neighbouring blocks (e.g., whether the neighbouring blocks are intra-coded). In some aspects, whether and/or how to apply the filter may be signalled with a syntax element such as in SPS/PPS/picture header/slice header/CTU/CU/PU.

In some aspects, during the IPM derivation, the IPM deriving component 4114 may attempt to reconstruct the target block in a first video unit based on the template in a second video unit and the template-reference samples of the template that are in a third unit. Whether DIMD can be applied to target block and/or the IPM derivation may depend on the relationship of the first video unit, or/and the second video unit, or/and the third video unit. In one example, the video unit may refer to PU/CU/VPDU/CTU/CTU row/slice/tile/sub-picture. In another example, DIMD can be applied to the current block when the first video unit, the second video unit, and the third video unit are the same video unit. In one example, DIMD cannot be applied to the target block when the first video unit is different from the second video unit or/and the third video unit. Alternatively, DIMD still can be applied to current block when the first video unit is different from the second video unit or/and the third video unit. In one example, the derived IPM may be set equal to a default IPM when the first video unit is different from the second video unit or/and the third video unit. In one example, the default IPM may refer to planar/DC/horizontal mode/vertical mode/diagonal top-right mode/diagonal bottom-left mode/diagonal top-left mode. In one example, the default IPM may be derived from neighbouring blocks. In one example, the default IPM may be derived from the decoded information.

In one example, DIMD cannot be applied to current block when the first video unit and the second video unit are the same, but different from the third video unit. In one example, the number of lines/rows/columns (denoted as M1) of the reference-template samples may be modified to N1 when the first video unit is different from the second video unit or/and the third video unit. In one example, N1 is less than or equal to M1, such as M1=4, N1=1 or M1=2, N1=1. In one example, the number of sample lines/rows/columns (denoted as M2) of the template may be modified to N2 when the second video unit is different from the third video unit. In one example, N2 is less than or equal to M2, such as M2=4, N2=1 or M2=2, N2=1.

Thus, as noted above, the decoding component 4110 may predict the samples in the current block with intra-prediction using the derived IPM that are selected from a subset of candidate IPMs. For example, the decoding component 4110 may predict the samples in the current block using any of the techniques described above. When all blocks are reconstructed, the frame or picture may be read out from the computing device 4102 as one of the plurality of video frames 4142 and output on a display.

FIG. 42 is a flowchart of an example method 4200 of decoding a blocks of an image associated with a video stream. The method 4200 may be performed for at least a current block or target block of an image associated with a video received at a computing device 4102. The method 4200 may be performed by a video decoder such as the video decoder 4100.

At block 4202, the method 4200 may include constructing, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates. The conversion may include decoding the current video block from the bitstream. The conversion may also include encoding the current video block into the bitstream. Aspects of block 4202 may be performed by the bitstream construction component 4112 that may receive an encoded bitstream 4146 from an external or internal source associated with the computing device 4102 as described in reference to FIG. 41.

At block 4204, the method 4200 may include deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks. In some examples, deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprises calculating a cost between a prediction of reconstructed samples in the at least one template and the reconstructed samples in the at least one template for each IPM of multiple IPMs from the first set of candidate IPMs and selecting the at least one IPM from the multiple IPMs based on the cost calculations for each IPM of the first set of candidate IPMs. In some aspects, the first set of candidate IPMs may be either derived or pre-defined. The first set of candidate IPMs may also be determined based on coding information regarding the current video block, wherein the coding information includes one or more of block dimension, block shape, slice or picture type of the current video block.

In some examples, the first set of candidate IPMs may include one or more of depth coding (DC), planar, or IPMs with mode numbers that are even or odd in the second set of candidate IPMs. The first set of candidate IPMs may include one or more of depth coding (DC), planar, or IPMs with mode number equal to X in the second set of candidate IPMs, wherein X % m==0, and m is an integer. The first set of candidate IPMs may also include one or more of depth coding (DC), planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode.

In some examples, the first set of candidate IPMs may be different according to coding information of the current video block, wherein the coding information includes one or more of block dimension, block shape, or slice type. All IPMs of the first set of candidate IPMs may be selected not from the second set of candidate IPMs.

In some examples, the first set of candidate IPMs may include IPMs with denser directions than IPMs of the second set of candidate IPMs. The one or more IPMs of the first set of candidate IPMs may be selected form the second set of candidate IPMs, and other IPMs of the first set of candidate IPMs are selected not form the second set of candidate IPMs. The IPMs of the first set of candidate IPMs may be partial or all of IPMs from a list of most probable modes (MPMs). The first set of candidate IPMs may include one or more IPMs selected from a list of most probable modes (MPMs) and pre-configured IPMs that are excluded from the list of MPMs, and the pre-configured IPMs includes one or more of depth coding (DC), planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode. The at least one IPM may be derived from partial IPMs of the first set of candidate IPMs.

In some aspects, the one or more IPMs of the second set candidate IPMs may be replaced by several IPMs, and the several IPMs may include wide-angle intra prediction modes, and wherein the at least one IPM is different from the several IPMs, or there are K identical IPMs in the at least one IPM and the several IPMs, and K is an integer greater than or equal to 1. Aspects of block 4204 may be performed by IPM deriving component 4114 that may select one or more IPMs from a subset of candidate IPMs 4116 as described in reference to FIG. 41.

At block 4208, the method 4200 may include determining, based on the at least one IPM, a final predictor of the current video block. Aspects of block 4208 may be performed by the decoding component 4110 as described with reference to FIG. 41.

At block 4210, the method 4200 may include performing the conversion based on the final predictor. Aspects of block 4210 may also be performed by the decoding component 4110 as described with reference to FIG. 41 that may output the decoded block into a plurality of video frames 4142.

While the foregoing disclosure discusses illustrative aspects and/or embodiments, it should be noted that various changes and modifications could be made herein without departing from the scope of the described aspects and/or embodiments as defined by the appended claims. Furthermore, although elements of the described aspects and/or embodiments may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated. Additionally, all or a portion of any aspect and/or embodiment may be utilized with all or a portion of any other aspect and/or embodiment, unless stated otherwise.

The previous description is provided to enable any person having ordinary skill in the art to practice the various aspects described herein. Various modifications to these aspects will be readily apparent to a person having ordinary skill in the art, and the generic principles defined herein may be applied to other aspects. The claims are not intended to be limited to the aspects shown herein, but is to be accorded the full scope consistent with the language claims, where reference to an element in the singular is not intended to mean “one and only one” unless specifically so stated, but rather “one or more.” Unless specifically stated otherwise, the term “some” refers to one or more. Combinations such as “at least one of A, B, or C,” “one or more of A, B, or C,” “at least one of A, B, and C,” “one or more of A, B, and C,” and “A, B, C, or any combination thereof” include any combination of A, B, or C, and may include multiples of A, multiples of B, or multiples of C. Specifically, combinations such as “at least one of A, B, or C,” “one or more of A, B, or C,” “at least one of A, B, and C,” “one or more of A, B, and C,” and “A, B, C, or any combination thereof” may be A only, B only, C only, A and B, A and C, B and C, or A and B and C, where any such combinations may contain one or more member or members of A, B, or C. All structural and functional equivalents to the elements of the various aspects described throughout this disclosure that are known or later come to be known to a person having ordinary skill in the art are expressly incorporated herein by reference and are intended to be encompassed by the claims. Moreover, nothing disclosed herein is intended to be dedicated to the public regardless of whether such disclosure is explicitly recited in the claims. The words “module,” “mechanism,” “element,” “device,” and the like may not be a substitute for the word “means.” As such, no claim element is to be construed as a means plus function unless the element is expressly recited using the phrase “means for.”

The following clauses describes some embodiments and techniques.

1. A method of coding video data, comprising:

-   -   constructing, during a conversion between a current video block         of a video and a bitstream of the video, at least one template         set for the current video block from a plurality of         sub-templates;     -   deriving, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks;     -   determining, based on the at least one IPM, a final predictor of         the current video block; and     -   performing the conversion based on the final predictor.

2. The method of clause 1, wherein deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprising:

-   -   calculating a cost between a prediction of reconstructed samples         in the at least one template and the reconstructed samples in         the at least one template for each IPM of multiple IPMs from the         first set of candidate IPMs; and     -   selecting the at least one IPM from the multiple IPMs based on         the cost calculations for each IPM of the first set of candidate         IPMs.

3. The method of clause 1, wherein the first set of candidate IPMs is either derived or pre-defined.

4. The method of clause 3, wherein the first set of candidate IPMs is determined based on coding information regarding the current video block, wherein the coding information includes one or more of block dimension, block shape, slice or picture type of the current video block.

5. The method of clause 1, wherein the first set of candidate IPMs includes one or more of depth coding (DC), planar, or IPMs with mode numbers that are even or odd in the second set of candidate IPMs.

6. The method of clause 1, wherein the first set of candidate IPMs includes one or more of depth coding (DC), planar, or IPMs with mode number equal to X in the second set of candidate IPMs, wherein X % m==0, and m is an integer.

7. The method of clause 1, wherein the first set of candidate IPMs includes one or more of depth coding (DC), planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode.

8. The method of clause 1, wherein the first set of candidate IPMs are different according to coding information of the current video block, wherein the coding information includes one or more of block dimension, block shape, or slice type.

9. The method of clause 1, wherein all IPMs of the first set of candidate IPMs are selected not form the second set of candidate IPMs.

10. The method of clause 9, wherein the first set of candidate IPMs includes IPMs with denser directions than IPMs of the second set of candidate IPMs.

11. The method of clause 9, wherein one or more IPMs of the first set of candidate

IPMs are selected form the second set of candidate IPMs, and other IPMs of the first set of candidate IPMs are selected not form the second set of candidate IPMs.

12. The method of clause 1, wherein IPMs of the first set of candidate IPMs are partial or all of IPMs from a list of most probable modes (MPMs).

13. The method of clause 1, wherein the first set of candidate IPMs includes one or more IPMs selected from a list of most probable modes (MPMs) and pre-configured IPMs that are excluded from the list of MPMs, and the pre-configured IPMs includes one or more of depth coding (DC), planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode.

14. The method of clause 1, wherein the at least one IPM is derived from partial IPMs of the first set of candidate IPMs.

15. The method of clause 1, wherein one or more IPMs of the second set candidate IPMs are replaced by several IPMs, and the several IPMs includes wide-angle intra prediction modes, and wherein the at least one IPM is different from the several IPMs, or there are K identical IPMs in the at least one IPM and the several IPMs, and K is an integer greater than or equal to 1.

16. The method of clause 1, wherein the conversion includes decoding the current video block from the bitstream.

17. The method of clause 1, wherein the conversion includes encoding the current video block into the bitstream.

18. An apparatus for processing video data comprising a processor and a non-transitory memory with instructions thereon, wherein the instructions upon execution by the processor, cause the processor to:

-   -   construct, during a conversion between a current video block of         a video and a bitstream of the video, at least one template set         for the current video block from a plurality of sub-templates;     -   derive, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks;     -   determine, based on the at least one IPM, a final predictor of         the current video block; and perform the conversion based on the         final predictor.

19. A non-transitory computer-readable recording medium storing a bitstream of a video which is generated by a method performed by a video processing apparatus, wherein the method comprises:

-   -   constructing, during a conversion between a current video block         of a video and a bitstream of the video, at least one template         set for the current video block from a plurality of         sub-templates;     -   deriving, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks;     -   determining, based on the at least one IPM, a final predictor of         the current video block; and     -   generating the bitstream from the current block based on the         final predictor.

20. A non-transitory computer-readable storage medium storing instructions that cause a processor to:

-   -   construct, during a conversion between a current video block of         a video and a bitstream of the video, at least one template set         for the current video block from a plurality of sub-templates;     -   derive, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks; determine, based on the at least         one IPM, a final predictor of the current video block; and     -   perform the conversion based on the final predictor.

21. A method of coding video data, comprising:

-   -   constructing, during a conversion between a current video block         of a video and a bitstream of the video, at least one template         set for the current video block from a plurality of         sub-templates;     -   deriving, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks, and wherein all or partial IPMs of         the first set of candidate IPMs are used to derived the at least         one IPM;     -   determining, based on the at least one IPM, a final predictor of         the current video block; and     -   performing the conversion based on the final predictor.

22. The method of clause 21, wherein deriving the at least one IPM from the first set of candidate IPMs based on the cost calculations comprises:

-   -   determining whether the at least one IPM from the first set of         candidate IPMs are included in one of a list of most probable         modes (MPMs) or associated with a neighboring block; and     -   organizing each of a plurality of IPMs within the first set of         candidate IPMs from a highest probability to lowest probability         based on the determination in part on whether the at least one         IPM from the first set of candidate IPMs are included in one of         the list of MPMs or associated with the neighboring block.

23. The method of clause 21, wherein deriving the at least one IPM from the first set of candidate IPMs based on the cost calculations comprises:

-   -   identifying a first sub-set of candidate IPMs from the first set         of candidate IPMs;     -   identifying a second sub-set of candidate IPMs from the first         set of candidate IPMs; and     -   selecting the IPM from one of the first sub-set of candidate         IPMs or the second sub-set of candidate IPMs.

24. The method of clause 21, wherein even or odd IPMs from the first set of candidate IPMs are used to derived the at least one IPM.

25. The method of clause 21, wherein deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprising:

-   -   determining that an absolute difference of mode number between a         first IPM and a second IPM from the first set of candidate IPMs         is less than or equal to a predetermined threshold, and wherein         the first IPM is not used to derived the at least one IPM from         the first set of candidate IPMs.

26. The method of clause 21, wherein deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprising:

-   -   identifying an optimal IPM from the first set of candidate IPMs;         and     -   searching a list of IPMs that are external to the first set of         candidate IPMs to obtained the at least one IPM.

27. The method of clause 21, wherein the list of IPMs that are external to the subset of candidate IPMs includes one or two neighboring denser angular IPMs may be checked if the optimal IPM is an angular intra prediction mode.

28. The method of clause 21, wherein deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprising:

-   -   identifying a number of IPMs from the first set of candidate         IPMs that need to be checked, wherein the number of IPMs that         need to be checked is at least based on coding information of         the current video block.

29. The method of clause 28, wherein the coding information of the block of the image is a combination of a block width and block height, and

-   -   wherein the combination of a block width and block height is         less than or equal to T1 value, a first number of IPMs from the         subset of candidate IPMs need to be checked prior to selection         of the IPM for decoding of the block of the image.

30. The method of clause 28, wherein the coding information of the block of the image is a combination of a block width and block height, and

-   -   wherein the combination of a block width and block height is         greater than or equal to T1 value, a second number of IPMs from         the subset of candidate IPMs need to be checked prior to         selection of the IPM for decoding of the block of the image.

31. The method of clause 30, wherein the T1 value is either 256 or 512.

32. The method of clause 21, wherein deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprising:

-   -   terminating a mode searching from the first set of candidate         IPMs based on the relationship between a cost value and a         pre-defined threshold.

33. The method of clause 25, wherein terminating the mode searching procedure of the DIMD after checking the mode candidate in the subset of candidate IPMs comprises:

-   -   determining that a cost for an IPM candidate from the subset of         IPM candidates is less than or equal to a C value; and     -   omitting testing of subsequent IPM candidates within the subset         of IPM candidates based on determining that the cost of the IPM         candidate is less than or equal to the C value.

34. The method of clause 26, wherein the C value is different for each IPM within the subset of IPM candidates.

35. An apparatus for processing video data comprising a processor and a non-transitory memory with instructions thereon, wherein the instructions upon execution by the processor, cause the processor to:

-   -   construct, during a conversion between a current video block of         a video and a bitstream of the video, at least one template set         for the current video block from a plurality of sub-templates;     -   derive, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks, and wherein all or partial IPMs of         the first set of candidate IPMs are used to derived the at least         one IPM;     -   determine, based on the at least one IPM, a final predictor of         the current video block; and perform the conversion based on the         final predictor.

36. A non-transitory computer-readable recording medium storing a bitstream of a video which is generated by a method performed by a video processing apparatus, wherein the method comprises:

-   -   constructing, during a conversion between a current video block         of a video and a bitstream of the video, at least one template         set for the current video block from a plurality of         sub-templates;     -   deriving, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks, and wherein all or partial IPMs of         the first set of candidate IPMs are used to derived the at least         one IPM;     -   determining, based on the at least one IPM, a final predictor of         the current video block; and     -   performing the conversion based on the final predictor.

37. A non-transitory computer-readable storage medium storing instructions that cause a processor to:

-   -   construct, during a conversion between a current video block of         a video and a bitstream of the video, at least one template set         for the current video block from a plurality of sub-templates;     -   derive, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded blocks, and wherein all or partial IPMs of         the first set of candidate IPMs are used to derived the at least         one IPM;     -   determine, based on the at least one IPM, a final predictor of         the current video block; and     -   perform the conversion based on the final predictor.

38. A method of coding video data, comprising:

-   -   determining, during a conversion between a current video block         of a video and a bitstream of the video, at least one template         set for the current video block from a plurality of         sub-templates and reconstructed samples of the at least one         template;     -   obtaining predicted samples of the at least one template set         based on candidate IPMs of a first set of candidate IPMs,         wherein the first set of candidate IPMs includes a number of         IPMs that are less than a second set candidate IPMs which         includes allowed IPMs for intra-coded block;     -   performing a filtering operation on the predicted samples         derived based on one more IPMs of the first set to get filtered         predicted samples;     -   calculating a cost between reconstructed samples and filtered         predicted samples, or the cost between reconstructed samples and         unfiltered predicted samples;     -   deriving, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations;     -   determining, based on the at least one IPM, a final predictor of         the current video block; and     -   performing the conversion based on the final predictor.

39. The method of clause 38, wherein one or more of the at least one template set or template-reference samples of the at least one template set are used to filter the predicted samples of the template.

40. The method of clause 38, wherein the one more IPMs includes at least one of DC mode, Planar mode, horizontal degree mode, vertical degree mode, diagonal top-right degree mode, diagonal bottom-left mode, or diagonal top-left mode.

41. The method of clause 38, wherein the one more IPMs includes at least one of intra prediction modes derived from horizontal degree mode, vertical degree mode, diagonal top-right degree mode, diagonal bottom-left mode, or diagonal top-left mode

42. The method of clause 38, wherein the filter operation is applied based on coding information of the current video block or neighboring blocks of the current video block, and wherein the coding information includes one or more of a block dimension, a block shape, a slice type, a dimension of a template set, or a shape of a template set.

43. The method of clause 38, wherein the coding information of the neighboring blocks includes whether the neighboring blocks are intra-coded, and the filter operation is applied in case that one or more neighboring blocks are intra-coded.

44. The method of clause 38, wherein the filter operation is applied based on an indication in the bitstream, and wherein the indication is signaled with a syntax element in sequence parameter set (SPS), picture parameter set (PPS), picture header, slice header, coding tree unit (CTU), coding unit (CU), Transform Unit (TU) or picture unit (PU).

45. The method of clause 38, wherein the filtering operation includes a position dependent prediction combination (PDPC) method.

46. An apparatus for processing video data comprising a processor and a non-transitory memory with instructions thereon, wherein the instructions upon execution by the processor, cause the processor to:

-   -   determine, during a conversion between a current video block of         a video and a bitstream of the video, at least one template set         for the current video block from a plurality of sub-templates         and reconstructed samples of the at least one template;     -   obtain predicted samples of the at least one template set based         on candidate IPMs of a first set of candidate IPMs, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded block;     -   perform a filtering operation on the predicted samples derived         based on one more IPMs of the first set to get filtered         predicted samples;     -   calculate a cost between reconstructed samples and filtered         predicted samples, or the cost between reconstructed samples and         unfiltered predicted samples;     -   derive, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations;     -   determine, based on the at least one IPM, a final predictor of         the current video block; and perform the conversion based on the         final predictor.

47. A non-transitory computer-readable recording medium storing a bitstream of a video which is generated by a method performed by a video processing apparatus, wherein the method comprises:

-   -   determining, during a conversion between a current video block         of a video and a bitstream of the video, at least one template         set for the current video block from a plurality of         sub-templates and reconstructed samples of the at least one         template;     -   obtaining predicted samples of the at least one template set         based on candidate IPMs of a first set of candidate IPMs,         wherein the first set of candidate IPMs includes a number of         IPMs that are less than a second set candidate IPMs which         includes allowed IPMs for intra-coded block;     -   performing a filtering operation on the predicted samples         derived based on one more IPMs of the first set to get filtered         predicted samples;     -   calculating a cost between reconstructed samples and filtered         predicted samples, or the cost between reconstructed samples and         unfiltered predicted samples;     -   deriving, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations;     -   determining, based on the at least one IPM, a final predictor of         the current video block; and     -   performing the conversion based on the final predictor.

48. A non-transitory computer-readable storage medium storing instructions that cause a processor to:

-   -   determine, during a conversion between a current video block of         a video and a bitstream of the video, at least one template set         for the current video block from a plurality of sub-templates         and reconstructed samples of the at least one template;     -   obtain predicted samples of the at least one template set based         on candidate IPMs of a first set of candidate IPMs, wherein the         first set of candidate IPMs includes a number of IPMs that are         less than a second set candidate IPMs which includes allowed         IPMs for intra-coded block;     -   perform a filtering operation on the predicted samples derived         based on one more IPMs of the first set to get filtered         predicted samples;     -   calculate a cost between reconstructed samples and filtered         predicted samples, or the cost between reconstructed samples and         unfiltered predicted samples;     -   derive, at least one intra-prediction mode (IPM) from a first         set of candidate IPMs based on cost calculations;     -   determine, based on the at least one IPM, a final predictor of         the current video block; and     -   perform the conversion based on the final predictor.

As noted above, the detailed inventions here should be considered as examples to explain general concepts. These inventions should not be interpreted in a narrow way. Furthermore, these inventions can be combined in any manner. In this disclosure, the term DIMD represents a coding tool that derives intra prediction mode using previously decoded blocks. In the disclosure, the “conventional intra prediction mode (IPM) candidate set” is used to indicate the allowed IPMs for intra-coded blocks (e.g., the 35 modes in HEVC, the 67 modes in VVC), and a “conventional intra prediction mode” may refer to an IPM in the conventional IPM candidate set.

In this disclosure, the “horizontal mode” refers to the intra prediction mode with mode number being equal to 18 in FIG. 6. The “vertical mode” refers to the intra prediction mode with mode number being equal to 50 in FIG. 6. The “diagonal top-right mode” refers to the intra prediction mode with mode number being equal to 65 in FIG. 6. The “diagonal bottom-left mode” refers to the intra prediction mode with mode number being equal to 2 in FIG. 6. The “diagonal top-left mode” refers to the intra prediction mode with mode number being equal to 34 in FIG. 6. These intra prediction modes may also refer to the intra prediction modes having the same direction in HEVC.

In this disclosure, the “template-reference samples” refers to the reconstructed samples used as the reference to derive the predicted samples of a template.

In this disclosure, the “the (derived) IPM is applied/used/enabled to a block” refers to the predictor of the block is generated using the (derived) IPM.

The following describes derivation of intra mode in DIMD:

-   1. Instead of explicitly signalling intra prediction mode of a block     to the decoder, it is proposed to derive one or more intra     prediction modes (IPMs) which are from a given IPM candidate set in     the decoder implicitly wherein the given IPM candidate set contains     a smaller number of IPMs than the conventional IPM candidate set.     -   a. In one example, for an IPM in the given IPM candidate list, a         cost is calculated between the prediction of reconstructed         samples in a template and the reconstructed samples in the         template. The mode in the given IPM candidate set with the         minimum cost is selected as the derived intra prediction mode.     -   b. Alternatively, for an IPM in the given IPM candidate list, a         cost is calculated according to the reconstructed samples in a         template, e.g., using the gradient values for the given         prediction direction associated with the IPM.     -   c. In one example, the given IPM candidate set may be         defined/derived on-the-fly.         -   i. In one example, the set may be determined according to             decoded information (e.g., the block dimension, block shape,             slice/picture type, etc.).             -   1) In one example, for I slices/pictures, the set only                 contains partial or full of the Most Probable Modes                 (MPMs) for the current block.             -   2) In one example, for inter-coded slices/pictures, the                 set may be set to the conventional IPM candidate set.     -   d. In one example, denote the number of IPMs in the given IPM         candidate set as N1 and the number of IPMs in the conventional         IPM candidate set as N2 (e.g., N1 and N2 is an integer). N1 may         be less than N2.         -   i. In one example, the N1 IPMs may be the pre-defined IPMs             which are from the conventional IPMs candidate set.             -   1) In one example, the N1 IPMs may be DC, or/and Planar,                 or/and IPMs with mode number being even.             -   2) In one example, the N1 IPMs may be DC, or/and Planar,                 or/and IPMs with mode number being odd.             -   3) In one example, the N1 IPMs may be DC, or/and Planar,                 or/and IPMs with mode number equal to X, where X % m==0,                 m is an integer, such as m=2/3/4.             -   4) In one example, the N1 IPMs may contain DC, or/and                 Planar, or/and horizontal mode, or/and vertical mode,                 or/and diagonal top-right mode, or/and diagonal                 bottom-left mode, or/and diagonal top-left mode.             -   5) In one example, the pre-defined intra prediction                 modes in the given IPM candidate set may be different                 according to the decoded information, such as block                 dimension/block shape/slice type.             -   6) Alternatively, the pre-defined intra prediction modes                 may not be from the conventional IPM candidate set.                 -   a) In one example, the pre-defined IPMs may be the                     IPMs have denser directions than conventional IPMs                     (e.g., IPMs denoted by the dashed lines in FIG. 23).             -   7) In one example, some pre-defined IPMs are from the                 conventional IPMs candidate set and the other                 pre-defined IPMs are not from the conventional IPMs                 candidate set.         -   ii. In one example, the N1 IPMs may be partial or full of             the MPMs for the current block.             -   1) In one example, some pre-defined intra prediction                 modes which are not in MPMs may also be contained in the                 given IPM candidate set.                 -   a) In one example, one or more IPMs from                     DC/Planar/horizontal/vertical/diagonal                     top-right/diagonal bottom-left/diagonal top-left                     modes may be contained in the given IPM set.                 -   b) In one example, one or more IPMs denoted by the                     dashed lines in FIG. 23 may be contained in the                     given IPM set.                 -    i. In one example, N1 may be equal to or larger                     than N2 when one or more IPMs denoted by the dashed                     red lines are contained in the given IPM set.         -   iii. In one example, N1 may be equal to or larger than N2.     -   e. In one example, the intra prediction mode may be derived from         the partial IPMs of the given IPM candidate set. Denote the         number of the partial IPMs of the given IPM candidate set as N3.         -   i. In one example, only partial IPMs from the given IPM             candidate set are used to derive the intra prediction mode             (such as N3 is less than N1).     -   f. In one example, when partial or all IPMs in the conventional         IPM candidate set may be replaced by several IPMs (e.g.,         wide-angle intra prediction modes), the derived IPM cannot be         one of the replaced IPMs.         -   i. Alternatively, the derived IPM may be one of the replaced             IPMs. -   2. All or partial IPMs in the given IPM candidate set may need to be     checked when deriving the optimal IPM. N denotes the total number of     IPMs in the given IPM candidate set.     -   a. In one example, all IPMs may need to be checked to derive the         optimal IPM (e.g., full search).     -   b. In one example, not all IPMs may need to be checked to derive         the optimal IPM.         -   i. In one example, the IPMs in the given IPM candidate set             may be re-ordered to assign a higher-possibility IPM             candidate with a smaller index according to certain rules             and the determination of derived IPM is based on the             re-ordered IPM candidate set.             -   1) In one example, the ordering (or possibility) is                 dependent on whether a mode is included in the MPM list                 of a current block and/or the order of modes in the MPM                 list.             -   2) In one example, the ordering (or possibility) is                 dependent on whether a mode is associated with the                 neighbouring blocks.             -   3) Alternatively, furthermore, if a first IPM candidate                 with a smaller index has a smaller cost compared to a                 second IPM candidate with a larger index, then the                 determination process is terminated and the first IPM                 candidate is selected as the derived IPM.             -   4) Alternatively, furthermore, if a first IPM candidate                 with a smaller index has a smaller cost compared to a                 second IPM candidate with a larger index and the                 absolute cost difference between the first and second                 IPM candidates is greater than a threshold, then the                 determination process is terminated and the first IPM                 candidate is selected as the derived IPM.         -   ii. A multi-step searching method may be applied.             -   1) In one example, for a first step, a first sub-set of                 the given IPM candidate set are searched to determine a                 second sub-set of given IPM candidate set to be searched                 in the next step. The selected IPM is determined in the                 final step. In the following discussion, suppose the IPM                 candidates are denoted as M[0], M[1], . . . M[N−1].                 -   a) In one example, in the first step (0-th step),                     the searching subset is {M[k×L]}, where L is a                     pre-defined number such as 4 or 8 and k is integers                     from 0 to (N−1)/L.                 -    i. In one example, in the p-th step, the searching                     subset is {M[k×(L/2^(p))]}.                 -     1) k may be in a range determined by the selected                     intra prediction mode in the (p−1)-th step.                 -      a. In one example, M[k₁×(L/2^(p))] is the                     selected intra prediction mode in the (p−1)-th step,                     k may be equal to 2k₁±T, T is an odd number, such as                     T=1 or 3.                 -     2) In one example, k is equal to K for all steps                     except 0-th step, such as K=2 or K=4.                 -   b) In one example, the process of searching one                     intra prediction mode may be skipped in the X-th                     step when the IPM has been searched in previous                     steps.                 -   c) Alternatively, furthermore, early termination may                     be used during the determination of the selected                     IPM.         -   iii. In one example, only IPMs with even mode number may be             checked.             -   1) Alternatively, only IPMs with odd mode number may be                 checked.     -   c. In one example, a first IPM in the given IPM candidate set         may be not checked when a second IPM has been checked when the         absolute difference of mode number between the first IPM and the         second IPM is less than or equal to V. V is an integer.         -   i. In one example, V may be equal to 1 or 2.     -   d. In one example, one or more IPMs which are not in the given         IPM candidate set may be further checked after the optimal IPM         is derived.         -   i. In one example, one or two neighbouring denser angular             IPMs may be checked if the optimal IPM is an angular intra             prediction mode.     -   e. In one example, the number of IPMs need to be checked may         depend on the decoded information (e.g., block dimensions). BW         and BH denote the block width and block height.         -   i. In one example, when BW×BH is less than or equal to T1,             N1 IPMs may need to be checked; when BW×BH is larger than             T1, N2 IPMs may need to be checked.             -   1) In one example, N1 may be equal to N2.             -   2) Alternatively, N1 may be less than N2.             -   3) Alternatively, N1 may be larger than N2.             -   4) In one example, T1 may be equal to 256.             -   5) Alternatively, T1 may be equal to 512.             -   6) In one example, N1 and N2 may be less than N.     -   f. In one example, the mode searching procedure of DIMD may be         early terminated after checking a mode candidate in the given         IPM candidate set.         -   i. In one example, when the cost for a IPM candidate is less             than or equal to C, the checking process for the other IPM             candidates may be skipped and the IPM may be determined as             the optimal IPM.             -   1) In one example, C may be a pre-defined value, such as                 C=0 or C=10.             -   2) In one example, the derivation of C may depend on the                 decoded information (e.g., block dimensions or/and the                 number of samples in the templates).                 -   a) In one example, C may be equal to h×(BW×BH),                     where h is scale factor (e.g., h=1, or 2).                 -   b) In one example, C may be equal to s×N^(t), where                     s is scale factor (e.g., s=1, or 2, or 4) and N^(t)                     denotes the number of samples in the templates.             -   3) In one example, different values of C may be set for                 different subset of IPM candidates.                 -   a) In one example, C1 is used for the first subset                     of IPM candidates and C2 is used for the second                     subset of IPM candidates. C1 may be less than or                     equal to C2.                 -    i. In one example, the first set of IPM candidates                     may consist of DC, or/and Planar, or/and horizontal                     mode, or/and vertical mode, or/and diagonal                     top-right mode, or/and diagonal bottom-left mode,                     or/and diagonal top-left mode. And the second set of                     IPM candidates may consist of the other modes in the                     mode candidate list.         -   ii. In one example, above early termination scheme may only             be applied after some certain IPM candidates are checked.             -   1) In one example, the certain mode candidates may refer                 to DC, or/and Planar, or/and horizontal mode, or/and                 vertical mode, or/and diagonal top-right mode, or/and                 diagonal bottom-left mode, or/and diagonal top-left                 mode.         -   iii. In one example, how to set the value of C may depend on             the decoded information (e.g., slice/picture type).         -   iv. In above examples, the C may be set to the per-sample             cost instead of the whole block's cost.     -   g. In one example, the set of IPMs need to be checked to derive         the optimal IPM may be depend on the decoded information such as         slice/picture type, or/and temporal layer.         -   i. In one example, the numbers of IPM candidates need to be             checked for different slice types may be the same. N1 and N2             denote the number of mode candidates for the first slice             type and the second slice type.             -   1) In one example, the first slice type may refer to I                 slice, and the second slice type may refer to P slice,                 or/and B slice.             -   2) In one example, N1 may be equal to N2.             -   3) Alternatively, the numbers of IPM candidates need to                 be checked for different slice types may be different.                 -   a) In one example, N1 may be less than N2.                 -   b) Alternatively, N1 may be larger than N2.         -   ii. In one example, the numbers of IPM candidates need to be             checked for different temporal layers may be the same. N3             and N4 denote the number of IPM candidates for the first             temporal layer and the second temporal layer.             -   1) In one example, the first temporal layer may refer to                 temporal layer TL1 and the second temporal layer refer                 to temporal layer TL2, where L1 is not equal to TL2                 (e.g., TL1=0 and TL2=1).             -   2) In one example, N3 may be equal to N4.             -   3) Alternatively, the numbers of IPM candidates need to                 be checked for different temporal layers may be                 different.                 -   a) In one example, N3 may be less than N4.                 -   b) Alternatively, N3 may be larger than N4.     -   h. In one example, indications of the set of IPMs need to be         checked to derive the optimal IPM may be signalled with a syntax         element, such as in SPS/PPS/picture header/slice header/CTU/CTU         row/CU. -   3. Instead of using the predicted samples and the reconstructed     samples of the template to calculate a cost for an IPM in the given     IPM candidate set, the predicted samples may be filtered first, and     the filtered predicted samples are used to calculate the cost.     -   a. In one example, the samples of the template, or/and the         template-reference samples of the template may be used to filter         the predicted samples of the template.         -   i. In one example, the template-reference samples of the             template may be unfiltered.         -   ii. Alternatively, the template-reference samples of the             template may be filtered using the method in bullet 4.f.         -   iii. In one example, the filter method may refer to PDPC.         -   iv. In one example, the determination of whether to apply             the filter may be same as the conventional intra prediction.             -   1) In one example, the filter may be applied to the                 predicted samples of the template for some selected                 IPMs.                 -   a) In one example, the selected IPMs may contain DC,                     or/and Planar, or/and horizontal degree mode, or/and                     vertical degree mode, or/and diagonal top-right                     degree mode, or/and diagonal bottom-left mode,                     or/and diagonal top-left mode.                 -   b) In one example, the selected IPMs may contain                     intra prediction modes derived from horizontal                     degree mode, or/and vertical degree mode, or/and                     diagonal top-right degree mode, or/and diagonal                     bottom-left mode, or/and diagonal top-left mode.                 -    i. In one example, the derived intra prediction                     modes may depend on the distance of intra prediction                     mode number.         -   v. In one example, the filter may be applied to the             predicted samples of the template for all IPMs in the given             IPM candidate set.     -   b. Whether to and/or how to apply the filter to the predicted         samples of the template may depend on the decoded information.         -   i. In one example, the decoded information may refer to             block dimension or/and block shape of current block.         -   ii. In one example, the decoded information may refer to the             decoded information of the neighbouring blocks (e.g.,             whether the neighbouring blocks are intra-coded).         -   iii. In one example, whether to and/or how to apply the             filter may be signalled with a syntax element such as in             SPS/PPS/picture header/slice header/CTU/CU/PU. -   4. During the IPM derivation, suppose the current block is in a     first video unit, the template is in a second video unit, and the     template-reference samples of the template are in a third unit.     Whether DIMD can be applied to current block and/or the IPM     derivation may depend on the relationship of the first video unit,     or/and the second video unit, or/and the third video unit.     -   a. In one example, the video unit may refer to         PU/CU/VPDU/CTU/CTU row/slice/tile/sub-picture.     -   b. In one example, DIMD can be applied to the current block when         the first video unit, the second video unit, and the third video         unit are the same video unit.     -   c. In one example, DIMD cannot be applied to current block when         the first video unit is different from the second video unit         or/and the third video unit.         -   i. Alternatively, DIMD still can be applied to current block             when the first video unit is different from the second video             unit or/and the third video unit.             -   1) In one example, the derived IPM may be set equal to a                 default IPM when the first video unit is different from                 the second video unit or/and the third video unit.                 -   a) In one example, the default IPM may refer to                     Planar/DC/horizontal mode/vertical mode/diagonal                     top-right mode/diagonal bottom-left mode/diagonal                     top-left mode.                 -   b) In one example, the default IPM may be derived                     from neighbouring blocks.                 -   c) In one example, the default IPM may be derived                     from the decoded information.         -   ii. In one example, DIMD cannot be applied to current block             when the first video unit and the second video unit are the             same, but different from the third video unit.     -   d. In one example, the number of lines/rows/columns (denoted as         M1) of the reference-template samples may be modified to N1 when         the first video unit is different from the second video unit         or/and the third video unit.         -   i. In one example, N1 is less than or equal to M1, such as             M1=4, N1=1 or M1=2, N1=1.         -   ii. In one example, the number of sample lines/rows/columns             (denoted as M2) of the template may be modified to N2 when             the second video unit is different from the third video             unit.             -   1) In one example, N2 is less than or equal to M2, such                 as M2=4, N2=1 or M2=2, N2=1. 

1. A method of coding video data, comprising: constructing, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates; deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks, wherein the first set of candidate IPMs is determined based on coding information regarding the current video block, wherein the coding information includes one or more of block dimension, block shape, slice or picture type of the current video block; determining, based on the at least one IPM, a final predictor of the current video block; and performing the conversion based on the final predictor.
 2. The method of claim 1, wherein deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations comprising: calculating a cost between a prediction of reconstructed samples in the at least one template and the reconstructed samples in the at least one template for each IPM of multiple IPMs from the first set of candidate IPMs; and selecting the at least one IPM from the multiple IPMs based on the cost calculations for each IPM of the first set of candidate IPMs.
 3. (canceled)
 4. (canceled)
 5. The method of claim 1, wherein the first set of candidate IPMs includes one or more of depth coding (DC), planar, or IPMs with mode numbers that are even or odd in the second set of candidate IPMs.
 6. The method of claim 1, wherein the first set of candidate IPMs includes one or more of depth coding (DC), planar, or IPMs with mode number equal to X in the second set of candidate IPMs, wherein X % m==0, and m is an integer.
 7. The method of claim 1, wherein the first set of candidate IPMs includes one or more of depth coding (DC), planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode.
 8. The method of claim 1, wherein the first set of candidate IPMs are different according to coding information of the current video block, wherein the coding information includes one or more of block dimension, block shape, or slice type.
 9. The method of claim 1, wherein all IPMs of the first set of candidate IPMs are selected not from the second set of candidate IPMs.
 10. The method of claim 9, wherein the first set of candidate IPMs includes IPMs with denser directions than IPMs of the second set of candidate IPMs.
 11. The method of claim 9, wherein one or more IPMs of the first set of candidate IPMs are selected form the second set of candidate IPMs, and other IPMs of the first set of candidate IPMs are selected not form the second set of candidate IPMs.
 12. The method of claim 1, wherein IPMs of the first set of candidate IPMs are partial or all of IPMs from a list of most probable modes (MPMs).
 13. The method of claim 1, wherein the first set of candidate IPMs includes one or more IPMs selected from a list of most probable modes (MPMs) and pre-configured IPMs that are excluded from the list of MPMs, and the pre-configured IPMs includes one or more of depth coding (DC), planar, horizontal mode, vertical mode, diagonal top-right mode, diagonal bottom-left mode, or diagonal top-left mode.
 14. The method of claim 1, wherein the at least one IPM is derived from partial IPMs of the first set of candidate IPMs.
 15. The method of claim 1, wherein one or more IPMs of the second set candidate IPMs are replaced by several IPMs, and the several IPMs includes wide-angle intra prediction modes, and wherein the at least one IPM is different from the several IPMs, or there are K identical IPMs in the at least one IPM and the several IPMs, and K is an integer greater than or equal to
 1. 16. The method of claim 1, wherein the conversion includes decoding the current video block from the bitstream.
 17. The method of claim 1, wherein the conversion includes encoding the current video block into the bitstream.
 18. An apparatus for processing video data comprising a processor and a non-transitory memory with instructions thereon, wherein the instructions upon execution by the processor, cause the processor to: construct, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates; derive, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks, wherein the first set of candidate IPMs is determined based on coding information regarding the current video block, wherein the coding information includes one or more of block dimension, block shape, slice or picture type of the current video block; determine, based on the at least one IPM, a final predictor of the current video block; and perform the conversion based on the final predictor.
 19. A non-transitory computer-readable recording medium storing a bitstream of a video which is generated by a method performed by a video processing apparatus, wherein the method comprises: constructing, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates; deriving, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks, wherein the first set of candidate IPMs is determined based on coding information regarding the current video block, wherein the coding information includes one or more of block dimension, block shape, slice or picture type of the current video block; determining, based on the at least one IPM, a final predictor of the current video block; and generating the bitstream from the current block based on the final predictor.
 20. A non-transitory computer-readable storage medium storing instructions that cause a processor to: construct, during a conversion between a current video block of a video and a bitstream of the video, at least one template set for the current video block from a plurality of sub-templates; derive, at least one intra-prediction mode (IPM) from a first set of candidate IPMs based on cost calculations, wherein the first set of candidate IPMs includes a number of IPMs that are less than a second set candidate IPMs which includes allowed IPMs for intra-coded blocks, wherein the first set of candidate IPMs is determined based on coding information regarding the current video block, wherein the coding information includes one or more of block dimension, block shape, slice or picture type of the current video block; determine, based on the at least one IPM, a final predictor of the current video block; and perform the conversion based on the final predictor. 